The problem of the change of the order status of the mall

when displaying a list of all orders, I want to process the overdue orders first and then query them (as shown above)
I can"t deal with the problem as shown in the figure. I"m afraid there will be an execution error during the loop, and I don"t want to prompt the front end
if I write a log, I can"t guarantee that the query behind is correct
how should I deal with this problem or not? Overdue orders should be processed before querying the list
consult ^ _ ^

Php
Mar.03,2021

suggest scheduled tasks,

in addition , exceptions can be caught here

try {
    // 
    
} catch (Exception $e) {
    // 
    
}

// 

generally this is handled by using the scheduled task execution script instead of looping through the list.


there is something wrong with the processing flow, such as the timed tasks mentioned above, and your processing in this way will also affect the query speed of the list

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e0df-2c3ca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e0df-2c3ca.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?