Im trying to update all users in the database to get +5 turns every time this script is run.
But it updates only the first user in the database untill it has full turns and then it updates the next user.
What do i have to do to add 5 turns to all users but dont add any if they have 100/100 turns?
<?php
include ("functions/db_connect.php");
$get_users = mysqli_query($db, "SELECT * FROM `members`") or die(mysql_error());
while($user = mysqli_fetch_assoc($get_users)){
if ($user['current_turns'] < $user['max_turns']) {
$update = mysqli_query($db, "UPDATE `members` SET
`current_turns`=`current_turns`+'5' WHERE `id`='".$user['id']."'") or die(mysql_error());
header("Location: users.php");
exit();
}
}
?>