ardyandkari Posted August 28, 2008 Share Posted August 28, 2008 i want to replace the number of people ($people) allowed in a specific camp site ($site). this is my code: <?php $sql = "UPDATE `resort`.`cabins` SET `people` = ".$people." WHERE `cabins`.`number` = ".$site.";"; ?> it comes up with the following 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 '' at line 1 what is wrong with the formatting of the mysql query? i copied this from phpmyadmin and removed some extraneous text (utf encoding, etc.)... thanks in advance... Link to comment https://forums.phpfreaks.com/topic/121631-solved-trying-to-replace-entries-in-the-db/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2008 Share Posted August 28, 2008 Echoing $sql would help. Are both the people and number columns defined as numeric data types? Link to comment https://forums.phpfreaks.com/topic/121631-solved-trying-to-replace-entries-in-the-db/#findComment-627447 Share on other sites More sharing options...
ardyandkari Posted August 28, 2008 Author Share Posted August 28, 2008 wow...thanks a lot... i am so stupid...i didnt assign the hidden variable a value... thanks for making me think and for telling me to echo the query...i feel soooooo stupid. Link to comment https://forums.phpfreaks.com/topic/121631-solved-trying-to-replace-entries-in-the-db/#findComment-627466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.