EchoFool Posted February 12, 2008 Share Posted February 12, 2008 I have a syntax error but not sure how to correct it. The idea is to change all rows with an id equal to or "less than" the value but i get this: 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 '=<'220'' at line 1 This is what i put: $Change = mysql_query("UPDATE messages SET Staff='0' WHERE Staff='{$_SESSION['Current_User']}' AND Sender='$ID' AND MessageID=<'{$row['MessageID']}'") Or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/90589-syntax-error/ Share on other sites More sharing options...
schilly Posted February 12, 2008 Share Posted February 12, 2008 Try $Change = mysql_query("UPDATE messages SET Staff='0' WHERE Staff='$_SESSION['Current_User']' AND Sender='$ID' AND MessageID='$row['MessageID']'") Or die(mysql_error()); If you haven't done any variable validation you may get errors as well. Link to comment https://forums.phpfreaks.com/topic/90589-syntax-error/#findComment-464479 Share on other sites More sharing options...
trq Posted February 12, 2008 Share Posted February 12, 2008 $Change = mysql_query("UPDATE messages SET Staff='0' WHERE Staff = '{$_SESSION['Current_User']}' AND Sender = '$ID' AND MessageID <= '{$row['MessageID']}'") Or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/90589-syntax-error/#findComment-464480 Share on other sites More sharing options...
EchoFool Posted February 12, 2008 Author Share Posted February 12, 2008 $Change = mysql_query("UPDATE messages SET Staff='0' WHERE Staff = '{$_SESSION['Current_User']}' AND Sender = '$ID' AND MessageID <= '{$row['MessageID']}'") Or die(mysql_error()); Argh thank you ! Had the <= the wrong way round! Link to comment https://forums.phpfreaks.com/topic/90589-syntax-error/#findComment-464496 Share on other sites More sharing options...
EchoFool Posted February 12, 2008 Author Share Posted February 12, 2008 Where is the topic solved button gone? Link to comment https://forums.phpfreaks.com/topic/90589-syntax-error/#findComment-464497 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.