thefollower Posted November 20, 2007 Share Posted November 20, 2007 I keep getting 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 'WHERE CountryID='1'' at line 1 Not sure what it means though.. this is my query: $UpdateTreasury = "UPDATE countries SET Treasury=Treasury+$Price WHERE CountryID='$CountryID'"; $treasuryresult = mysql_query($UpdateTreasury) or die(mysql_error()); Can't see why its not allowing the WHERE clause.. Any one know why? Quote Link to comment https://forums.phpfreaks.com/topic/78133-solved-what-does-this-mean/ Share on other sites More sharing options...
trq Posted November 20, 2007 Share Posted November 20, 2007 Change your code to.... $UpdateTreasury = "UPDATE countries SET Treasury=Treasury+$Price WHERE CountryID='$CountryID'"; die($UpdateTreasury); $treasuryresult = mysql_query($UpdateTreasury) or die(mysql_error()); and show us the output. Quote Link to comment https://forums.phpfreaks.com/topic/78133-solved-what-does-this-mean/#findComment-395390 Share on other sites More sharing options...
thefollower Posted November 20, 2007 Author Share Posted November 20, 2007 UPDATE countries SET Treasury=Treasury+ WHERE CountryID='1' Ok looks like my variable is empty then. Good spot. Quote Link to comment https://forums.phpfreaks.com/topic/78133-solved-what-does-this-mean/#findComment-395402 Share on other sites More sharing options...
revraz Posted November 20, 2007 Share Posted November 20, 2007 Yes, you always need to check first to see if any variable is empty. Quote Link to comment https://forums.phpfreaks.com/topic/78133-solved-what-does-this-mean/#findComment-395410 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.