Lamez Posted February 25, 2008 Share Posted February 25, 2008 I hate using the update function, what am I doing wrong here? $q = "UPDATE `points` SET 1=$a, SET 2=$b, SET 3=$c, SET 4=$d, SET 5=$e, SET 6=$f WHERE id=$id"; mysql_query($q)or die(mysql_error()); I get this error: 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 '1=0, SET 2=0, SET 3=0, SET 4=0, SET 5=0, SET 6=0 WHERE id=1' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/92806-what-is-wrong/ Share on other sites More sharing options...
KrisNz Posted February 25, 2008 Share Posted February 25, 2008 I think you need `` around your column names. as in `1`=$a. Quote Link to comment https://forums.phpfreaks.com/topic/92806-what-is-wrong/#findComment-475450 Share on other sites More sharing options...
Lamez Posted February 25, 2008 Author Share Posted February 25, 2008 I just tried that, and it did not work.. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/92806-what-is-wrong/#findComment-475473 Share on other sites More sharing options...
KrisNz Posted February 25, 2008 Share Posted February 25, 2008 Oh yeah, you also only SET once ie. $a = 10; $b = 20; $q = "UPDATE points SET `1`=$a,`2`=$b "; Quote Link to comment https://forums.phpfreaks.com/topic/92806-what-is-wrong/#findComment-475476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.