This question already has an answer here:
I'm trying to figure out how to update MySQL rows older than 30 seconds or 30 minutes.
$sql = "SELECT C.sessid, C.datetime, U.username, U.firstname, U.lastname, U.sessid FROM checkins C, users U WHERE U.sessid = C.sessid AND SUBTIME(NOW(),'0 00:01:00')>C.datetime";
$result = mysql_query( $sql );
while( $row = mysql_fetch_array( $result, MYSQL_ASSOC ) ) {
mysql_query("UPDATE checkins SET status = 'was in'");
}
Here I have joined tables, just the users table and checkins table. I am using subtime to determine the time difference and trying to update rows of checkins table if the C.datetime is older than 1 minute just for a test
</div>