Jump to content


Photo

Multiple Delete


  • Please log in to reply
2 replies to this topic

#1 Funky_Monk

Funky_Monk
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 01 July 2004 - 06:45 AM

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).

#2 parksmike

parksmike
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 July 2004 - 04:54 PM

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());
}

<><><><><><><><><><><><><><><><><>[br]Mike

#3 Arenium

Arenium
  • Staff Alumni
  • Advanced Member
  • 111 posts
  • LocationMassachusetts

Posted 02 July 2004 - 05:54 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users