Files
HotLunches/zero-order-num.check.php
2026-10-19 15:22:52 -07:00

31 lines
880 B
PHP

<?php
include "/m/data1/app.hotlunches.net/db.php";
$query = "SELECT DISTINCT school_num,ordered_by_num,schedule_num FROM hotlunch_order_items WHERE order_num = 0 AND school_num > 0";
$results = db_query($query);
$time = time() - 60 * 60;
while ($row = db_fetch_assoc($results)) {
extract($row);
$query = "SELECT * FROM hotlunch_order_header " .
"WHERE school_num = $school_num " .
"AND ordered_by_num = $ordered_by_num " .
"AND schedule_num = $schedule_num " .
"AND added_time < $time";
$oh = db_getVal($query);
if ($oh) {
extract($oh);
$query = "UPDATE hotlunch_order_items SET order_num = $record_num " .
"WHERE school_num = $school_num " .
"AND ordered_by_num = $ordered_by_num " .
"AND schedule_num = $schedule_num";
db_query($query);
}
}
?>