I am running a script that run the following code for all of the users and update the MySQL database. Currently, it updates more than 400.000 times, something that it is huge for the processing power of my server.
while($usersResult = mysql_fetch_assoc($get_users)) {
$percentile_rank = $percentile_rank * $user_variable / 100);
mysql_query("UPDATE new_table SET percentile_visits_frequency='$percentile_rank' WHERE hash='$usersResult[hash]'");
}
I wonder if there is a way to edit the code, in order to update 1000, 2000 or 10.000 hash
with one query, instead 1 query for each hash
.
Thank you