40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
include "db.php";
|
|
include "table.php";
|
|
|
|
$hloh_table = new Table("hotlunch_order_header");
|
|
|
|
// $swhere = "AND school_num < 100 ";
|
|
$query = "SELECT * FROM hotlunch_order_header WHERE ordered_by_type != 'Concession' $swhere AND (ordered_by_status = '' OR ordered_by_status IS NULL) ORDER BY school_num,record_num";
|
|
$orders = db_query($query);
|
|
|
|
while ($row = db_fetch_assoc($orders)) {
|
|
extract($row);
|
|
|
|
$onum = $record_num;
|
|
$pnum = $ordered_by_num;
|
|
|
|
$results = db_query("SELECT * FROM people WHERE school_num = $school_num AND record_num = $pnum");
|
|
if (db_num_rows($results) == 1) {
|
|
$person = db_fetch_assoc($results);
|
|
|
|
$entry = array();
|
|
$entry['ordered_by_first_name'] = $person['first_name'];
|
|
$entry['ordered_by_last_name'] = $person['last_name'];
|
|
$entry['ordered_by_status'] = 'Active User';
|
|
$entry['record_num'] = $onum;
|
|
|
|
$query = $hloh_table->BuildUpdate($entry);
|
|
// echo("$query\n");
|
|
db_query($query);
|
|
}
|
|
else {
|
|
$query = "UPDATE hotlunch_order_header SET ordered_by_status = 'Not Found' WHERE school_num = $school_num AND record_num = $onum";
|
|
// echo("$query\n");
|
|
db_query($query);
|
|
}
|
|
}
|
|
|
|
?>
|