Forum Moderators: coopster
<?php
===QueryString===
delete.php?q=169¦170¦171¦
$arr = explode('¦', $q);
for ($i = 0; $i < count($arr); $i++) {
$query .= "DELETE FROM aCar WHERE aID =
'".$arr[i]."'";
$result =mysql_query($query);
}
?>
you don't need to count on every iteration, count once and store it in a var
$arrcnt = count($arr);
for ($i = 0; $i < $arrcnt; $i++) {
you're missing a $ in this line and if aID is an integer then you don't use ', you also shouldn't need the concatenation at the beginning, you should be replacing the value
$query = "DELETE FROM aCar WHERE aID = .$arr[$i];
so with changes and an or die for good luck
$arrcnt = count($arr);
for ($i = 0; $i < $arrcnt; $i++) {
$query = "DELETE FROM aCar WHERE aID = .$arr[$i];
$result =mysql_query($query) or die($i . ':' . mysql_error());
}