mysql delete loop

From: Date: Fri, 07 Mar 2003 10:53:25 +0000
Subject: mysql delete loop
Groups: php.db 
Request: Send a blank email to php-db+get-26161@lists.php.net to get a copy of this message
displayexpt.php?softID=$softID displays a checkbox list of experts for a given piece of software. The admin needs to select each user he wants to delete. This is then posted to deleteexpt.php?softID=$softID, which must delete users from the apliexpert table with a statement like this: DELETE FROM apliexpert WHERE id=$id AND softID=$softID; Given more than one expert may need to be deleted I think I need some kind of loop that makes a passes a different delete statement for each $id. To handle the multiple $ids I have the following for loop: ##### code ######## for ($index = 0; $index < $total_records; $index++) { if (isset($id[$index])) { $sql2 .= "Clave = \"" . $id[$index] . "\""; } ##### end ######## I've tried changing $sql2 to: "DELETE FROM apliexpert WHERE id = \"" . $id[$index] . "\""; but the loop doesn't work; it deletes the first record and then stops. thanks :)) J __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.db (#26161) next »