sstangle73 Posted October 7, 2007 Share Posted October 7, 2007 mysql_query("UPDATE image SET Default = '1' WHERE 'IMG_ID' = '$_POST[default]'") or die(mysql_error()); returns 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 'Default = '1' WHERE 'IMG_ID' = '3'' at line 1 Link to comment https://forums.phpfreaks.com/topic/72197-solved-update/ Share on other sites More sharing options...
pocobueno1388 Posted October 7, 2007 Share Posted October 7, 2007 I'm pretty sure "Default" is a reserved word for MySQL. Try this: mysql_query("UPDATE image SET `Default` = '1' WHERE IMG_ID = '{$_POST['default']}'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/72197-solved-update/#findComment-364074 Share on other sites More sharing options...
sstangle73 Posted October 7, 2007 Author Share Posted October 7, 2007 thanks what about makeing it select bassed on 2 things? "SELECT * FROM image WHERE ID = '$ID', `Default`='1' LIMIT 1"; 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 ' `Default`='1' LIMIT 1' at line 1 Link to comment https://forums.phpfreaks.com/topic/72197-solved-update/#findComment-364076 Share on other sites More sharing options...
pocobueno1388 Posted October 7, 2007 Share Posted October 7, 2007 SELECT * FROM image WHERE ID = '$ID' AND `Default`='1' LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/72197-solved-update/#findComment-364078 Share on other sites More sharing options...
sstangle73 Posted October 7, 2007 Author Share Posted October 7, 2007 yeah i used & and got it thanks Link to comment https://forums.phpfreaks.com/topic/72197-solved-update/#findComment-364079 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.