perrij3 Posted August 15, 2009 Share Posted August 15, 2009 What I am trying to do is delete all records in a database that a user selects to delete using a check box. The from works and the array I have set up collects the data correctly. Where the issue is is with the mysql statement. This is what I am using: mysql_query("DELETE image WHERE image_ID IN ($removeImage)") or trigger_error(mysql_error(),E_USER_ERROR); This is the error message I am getting: 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 image_ID IN ('9,10')' at line 1 I used the tutorial on this site to get the rest of the code to work, but the tutorial is set up for updating the records, not deleting them. Could someone please help me with what I am doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/170347-solved-deleting-from-a-database-using-an-array/ Share on other sites More sharing options...
taquitosensei Posted August 15, 2009 Share Posted August 15, 2009 you forgot the "from" DELETE FROM image plus there's single quotes around the 9,10 where there shouldn't be. Quote Link to comment https://forums.phpfreaks.com/topic/170347-solved-deleting-from-a-database-using-an-array/#findComment-898608 Share on other sites More sharing options...
perrij3 Posted August 15, 2009 Author Share Posted August 15, 2009 Thanks, that was the problem. I was missing FROM. Stupid mistake, but I am thankful for your help. Quote Link to comment https://forums.phpfreaks.com/topic/170347-solved-deleting-from-a-database-using-an-array/#findComment-898613 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.