refiking Posted April 7, 2008 Share Posted April 7, 2008 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 '21'' at line 1 I am trying to update the db by team name. Each team is a field on the db. So, how can I fix this error message? Here is the code: mysql_query("UPDATE davt SET $tm = '' WHERE lid = '$lid' AND sid = '$sid'")or die(mysql_error()); mysql_query("UPDATE davt SET $tm = '$owner' WHERE lid = '$lid AND sid = '$sid'")or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/ Share on other sites More sharing options...
quickstopman Posted April 7, 2008 Share Posted April 7, 2008 mysql_query("UPDATE davt SET $tm = '' WHERE lid = '$lid' AND sid = '$sid'")or die(mysql_error()); mysql_query("UPDATE davt SET $tm = '$owner' WHERE lid = '$lid' AND sid = '$sid'")or die(mysql_error()); you forgot to close off, on the second line lid = '$lid' it was just lid = '$lid AND sid = ect... that should fix the error! Your Welcome, Zack Link to comment https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/#findComment-511419 Share on other sites More sharing options...
craygo Posted April 7, 2008 Share Posted April 7, 2008 Beat me to it Link to comment https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/#findComment-511420 Share on other sites More sharing options...
refiking Posted April 7, 2008 Author Share Posted April 7, 2008 DUH!!!! Thanks gurus! Link to comment https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/#findComment-511468 Share on other sites More sharing options...
quickstopman Posted April 7, 2008 Share Posted April 7, 2008 your welcome Link to comment https://forums.phpfreaks.com/topic/100009-error-in-sql-syntax/#findComment-511508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.