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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.