I wanted to know if is there any solutions to delete multiple rows in one query?
I’m using a select element with multiple input so I have an array in my $_POST when I’m sending my form.
For example, I want to unsubscribe an users from one table to more than one lesson So I have:
users.id | lesson.id
--------------------
1 | 1
1 | 2
1 | 3
1 | 4
My select post me an array with the lesson.id:
Array
(
[0] => 2
[1] => 3
[2] => 4
)
How can I with only one query, delete all rows from my table ?
BTW, I know the users.id all the time.
If you want to delete just these three
lesson_idsIf you want to delete all but one arbitrary lesson and you know, user 1 has 4 lessons, then you can
limitthe delete to 3 lesson_ids