I want to run one query with multiple statements to delete records from my database all at once. I construct a mysql query like so:
$query = "DELETE FROM myTable1 WHERE indexID = '".$myVar."' LIMIT 1; ";
$query .= "DELETE FROM myTable2 WHERE indexID = '".$myVar."' LIMIT 1; ";
$query .= "DELETE FROM myTable3 WHERE indexID = '".$myVar."' LIMIT 6; ";
Then, I call my query something like this:
if(!$result = mysqli_query($db, $query)) {
echo "error with $query";
}
Am I doing something incorrect? The query that gets printed out, when copied and run inside phpMyAdmin works just fine.