refiking Posted April 27, 2008 Share Posted April 27, 2008 Here is what the script returned: 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 'testuser'' at line 1 Here is the line they are referring to: mysql_query("UPDATE dpicks SET first = '$num1' WHERE user = '$user'")or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/103147-solved-sql-syntax-error/ Share on other sites More sharing options...
DarkerAngel Posted April 27, 2008 Share Posted April 27, 2008 ... try ticking your columns: mysql_query("UPDATE `dpicks`SET `first`='$num1' WHERE `user`='$user'") or die(msql_error()); mod-edit. You don't need to quote all of a previous post. Link to comment https://forums.phpfreaks.com/topic/103147-solved-sql-syntax-error/#findComment-528363 Share on other sites More sharing options...
AndyB Posted April 27, 2008 Share Posted April 27, 2008 `backticks` might help if any of the variable names used had been MySQL reserved words, but as they're not backticks would be pointless. For reference purposes - http://dev.mysql.com/doc/refman/4.1/en/reserved-words.html @refiking - are you sure that error report refers to the line you quote? Link to comment https://forums.phpfreaks.com/topic/103147-solved-sql-syntax-error/#findComment-528365 Share on other sites More sharing options...
DarkWater Posted April 27, 2008 Share Posted April 27, 2008 Do this for us please: $query = "UPDATE dpicks SET first = '$num1' WHERE user = '$user'"; echo $query . '<br />'; mysql_query($query)or die(mysql_error()); Show us the error and the actual parsed query. Thanks. Link to comment https://forums.phpfreaks.com/topic/103147-solved-sql-syntax-error/#findComment-528375 Share on other sites More sharing options...
refiking Posted April 27, 2008 Author Share Posted April 27, 2008 I found it guys sorry for taking so long to reply. I have about 25 queries just like that 1. The problem was I forgot the ' on one of them. Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/103147-solved-sql-syntax-error/#findComment-528389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.