ferlicia Posted July 28, 2011 Share Posted July 28, 2011 $query = "UPDATE criteria set $addcriteria = $addcri WHERE studentID = $row[$i]"; 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 studentID = 10002' at line 1 can you help me spot the error? Quote Link to comment https://forums.phpfreaks.com/topic/243078-you-have-an-error-in-your-sql-syntax/ Share on other sites More sharing options...
the182guy Posted July 28, 2011 Share Posted July 28, 2011 Looks like $addcriteria is the problem. You need to echo out the query so you can see exactly what is being used. $query = "UPDATE criteria set $addcriteria = $addcri WHERE studentID = $row[$i]"; die($query); // show the query Quote Link to comment https://forums.phpfreaks.com/topic/243078-you-have-an-error-in-your-sql-syntax/#findComment-1248390 Share on other sites More sharing options...
phpSensei Posted July 28, 2011 Share Posted July 28, 2011 $query = "UPDATE `criteria` SET `addcriteria` = '$addcri' WHERE `studentID` = '".$row[$i]."'"; I dont know why your passing $i though, and $addcritera is a variable not a column name Quote Link to comment https://forums.phpfreaks.com/topic/243078-you-have-an-error-in-your-sql-syntax/#findComment-1248391 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.