Files
HotLunches/ocheck.php
T
2026-10-19 15:22:52 -07:00

45 lines
1.2 KiB
PHP

<?php
include "db.php";
$query = "SELECT order_num,ordered_by_num,count(*) FROM hotlunch_order_items " .
"WHERE ordered_by_type IN ('Student', 'Staff') AND schedule_num = 2462 " .
"group by 1,2 " .
"order by 2,1";
$orders = db_query($query);
$count = 0;
$prev_person = 0;
while ($row = db_fetch_array($orders)) {
$person = $row['ordered_by_num'];
if ($prev_person == $person) {
echo("$prev_person\n");
}
// Check each person for a valid class number
$results = db_query("SELECT * FROM people WHERE record_num = $person");
$row = db_fetch_array($results);
$class_num = $row['class_num'];
$name = $row['first_name'] . ' ' . $row['last_name'];
$status = $row['status'];
if ($status != 'Unverified' && $status != 'Verified') echo("Status: $status - $name\n");
if ($class_num == 0) echo("Staff: $name\n");
else {
$class = db_query("SELECT * FROM classes WHERE record_num = $class_num");
if (db_num_rows($class) == 0) {
echo("Class Not Found: $name\n");
}
}
if ($row['people_type'] != 'Student') echo("Not Student: $name\n");
$prev_person = $person;
$count++;
}
echo("Count: $count\n");
?>