bulrush Posted May 18, 2010 Share Posted May 18, 2010 Can I delete multiple records with one DELETE statement? Like this: DELETE FROM table WHERE id=1 or id=2; I guess my alternative is, can I execute 2 delete statements in one PHP query command? $query="DELETE FROM table WHERE id=1; "; $query.="DELETE FROM table WHERE id=2; "; $result=mysqli_query($dbc,$query); Quote Link to comment https://forums.phpfreaks.com/topic/202186-delete-multiple-records-with-one-delete-statement/ Share on other sites More sharing options...
Mchl Posted May 18, 2010 Share Posted May 18, 2010 Yes you can. And no, the second one will not work. Only one query per one mysqli_query() call allowed. Quote Link to comment https://forums.phpfreaks.com/topic/202186-delete-multiple-records-with-one-delete-statement/#findComment-1060218 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.