I am updating records using a cron job that works perfectly fine. The issue I have is that the script is updating all records using the information from the first row matching my WHERE condition.
I'm using the following to query the database for data.
The row I'm searching for information from is time in the database, and mtime is a row that holds max time for the test.
So now what I want to be able to do is rather then having it only checking the mtime from the first row it pulls data from because each row has different mtime values. I would like to learn how to grab the first row check time vrs mtime update then move to the next record.
Thanks for all help ahead of time!
I'm using the following to query the database for data.
The row I'm searching for information from is time in the database, and mtime is a row that holds max time for the test.
Code:
$query = "SELECT * FROM info WHERE class = 'Math'";
$data = mysqli_query($db, $query);
$row = mysqli_fetch_array($data);
$time = 5;
// Begin and IF statement to update the rows
if ($row['time'] != $row['mtime']) {
$updatetime = $query = "UPDATE info set time=time+$time, WHERE class = 'Math'";
} // Close If
Thanks for all help ahead of time!
Comment