I have to update the status of multiple rows in a MySQL table using PHP. Practically, there will be around 200 rows that needs status update at once. Currently am using a loop to update the rows.
$status = '0';
$date = 'YYYY-MM-DD';
$result = mysql_query("SELECT * FROM `table` WHERE `status`='$status' AND `date`='$date'") or die(mysql_error());
foreach($result as $row){
mysql_query("UPDATE `table` SET `status`='1'or die(mysql_error())");
}
This is taking quite some time to get the status updated. Is there a better or rather easier way available to do this instead of looping over 200 times each time?
Thanks in advance!