Delete multiple entries using mysql?

how do i delete multiple entries from a table using mysql commands?

i tried doing: delete from table_name where id = “11”, “12”, “13”;
but obviously i was doing it wrong…

help mey peez :nerd:

oooooooh sorry… forgot all about this… i’m not really sure, I would try doing different querys…

$q1 = delete from table_name where id = “11”
$q2 = delete from table_name where id = “12”
$q3 = delete from table_name where id = “13”

$r1 = mysql_query($q1);
$r2 = mysql_query($q2);
$r3= mysql_query($q3);

something like that would work.

this is how i usually do it:

<?php
$deleteArray[0]=11;
$deleteArray[1]=12;
$deleteArray[2]=13;
mysql_connect('localhost', 'root');
mysql_select_db('mydb');
for ($i=0; $i<2; $i++) {
$id_num = $deleteArray[$i];
$query = "DELETE FROM table WHERE id_num='$id_num'";
$result = mysql_query($query);
echo "$id_num is deleted! <**br>";
}
?>

… you might be fine though using jubba’s way, i used the array way cause i had a lot of non-consecutive records that i needed to delete :slight_smile:

yeah, I like his way better. :slight_smile: