Jump to content

[SOLVED] Deleting from a database using an array


perrij3

Recommended Posts

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.