PHP-MYSQL UPDATE SYNTAX ERROR?

  • Thread starter Thread starter Wes D
  • Start date Start date
W

Wes D

Guest
I have the following query to update a database table from a form and when I run it, I get a syntax error.

$query = "UPDATE dues SET jan='$jan', feb='$feb', mar='$mar', apr='$apr', may='$may', jun='$jun', jul='$jul', aug='$aug', sep='$sep', oct='$oct', nov='$nov', dec='$dec' WHERE ID=$id";
$result = mysql_query($query);

when I echo mysql_error(); I get the following:
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 'dec='Not Paid' WHERE 'ID'=1' at line 1

I have already tried putting single quotes around $id but that didn't fix it either, I tried removing the commas and it didn't work either. I tried putting the values in parenthases and it didnt work. I have tried a lot of things and NOTHING has worked. I have no idea what I need to change.

I need help because I usually set up all my other update statements just like this one, (syntax-wise), but for some reason this one wont work.

If you need more details to figure it out, just let me know.

Thank You!!
 
Back
Top