Re: delete multiple records with one query
| From: | Adam Royle | Date: | Tue, 02 Jul 2002 12:15:57 +0000 |
| Subject: | Re: delete multiple records with one query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20259@lists.php.net to get a copy of this message | ||
another way to do this is (quicker, using only one query):
$delete_IDs = implode(",",$name_array);
$sql = "DELETE FROM $mysql_table WHERE id IN ($delete_IDs)";
mysql_query($sql);
or you could delete the first line (implode) and take the square brackets out of the name of the form field. this will make a comma-delimited string of all your selected ID numbers, and will be available in $name_array
your choice
adam