I have query 1 and query 2 to update the same table.
How do i optimize this to single query.
$query1 = "UPDATE user_permissions SET active= 0 WHERE user_id = $my_user_id AND page_id =5";
$query2 = "UPDATE user_permissions SET active= 0 WHERE user_id = $my_user_id AND page_id =6";
Use IN
Like this:
UPDATE user_permissions SET active= 0 WHERE user_id = $my_user_id AND page_id IN (5, 6)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.