-1

Hi, I need to update the database. I made this code but it's not working:

<?php
if (isset($_COOKIE['credits_id'])) {
tep_db_query("update " . TABLE_CUSTOMERS . " set credits+ WHERE customers_id='".mysql_real_escape_string($_COOKIE['credits_id']). "'");
}
else
{
echo 'fout';
}
?>

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+ WHERE customers_id='17'' at line 1

update customers set credits+ WHERE customers_id='17'

[TEP STOP]

It needs to update the field credits in table customers. How can I do this?

Andrew Kozak
  • 1,631
  • 2
  • 22
  • 35
kevin
  • 1
  • 2
  • Using this type of "authentication", everybody can increase all credits. Are you sure you want that? – str Nov 27 '11 at 13:11

1 Answers1

1

Your update query is not proper:

"update " . TABLE_CUSTOMERS . " set credits = credits + $someNewValue WHERE customers_id='".mysql_real_escape_string($_COOKIE['credits_id']). "'"

Hope it helps

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162