I'm trying to combine 2 queries into one like this
$result=$db->query ("DELETE FROM menu WHERE name = '$new'") or die($db->error);
$result=$db->query ("DELETE FROM pages WHERE title = 'new'") or die($db->error);
Into
$result=$db->query ("DELETE FROM menu AS m, pages AS p WHERE m.name = 'new' AND p.title='new'") or die($db->error);
But DB gives syntax error. What's wrong?
DELETE operations have to be done one table at a time. There's no way to combine them as you are trying to do. Depending on what you're trying to accomplish, you may want to use a transaction for the two operations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With