Let's say I have an array with a bunch of ids for a mysql table:
$idList = array('1','2','3','4','5');
I want to delete the rows associated with each id. Which method is more preferable/better/faster (IYO)?
$idListString = implode(",",$idList);
mysql_query("DELETE FROM this_table WHERE id IN ($idListString)");
or
foreach($idList as $value) {
mysql_query("DELETE FROM this_table WHERE id = '$value'");
}