Jump to content

Archived

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

Funky_Monk

Multiple Delete

Recommended Posts

Can someone tell me how to delete multiple records in a database using checkboxes (so that you can select the ones you want to delete).

Share this post


Link to post
Share on other sites

Hello,

Your checkbox items are going to pass as an array.

 

Try something like:

foreach($checkbox as $key => $value){
    $sql = mysql_query("delete from table where id = '$value'") or die(mysql_error());
}

Share this post


Link to post
Share on other sites

Mhm, or you could be daring and gaze at some phpMyAdmin code for a while. I know, I know, it's not OOP, so it's a bit difficult to follow, but at least it works :D

Share this post


Link to post
Share on other sites

×

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.