$linked\n"); $count = 0; while ($row = db_fetch_assoc($ordered)) { $order_num = $row['order_num']; $ordered_by_num = $row['ordered_by_num']; $row['menu_num'] = $linked_menu; $row['menu_item_num'] = $linked; $query = "SELECT * FROM hotlunch_order_items WHERE order_num = $order_num AND school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $linked_menu AND menu_item_num = $linked"; $results = db_query($query); if (db_num_rows($results) == 0) { $original = db_getVal("SELECT order_total FROM hotlunch_order_header WHERE school_num = $school_num AND schedule_num = $schedule_num AND record_num = $order_num"); $query = $hloiTable->BuildInsert($row); db_query($query); calcOrderTotal($order_num,$schedule_num,'N'); $ototal = db_getVal("SELECT order_total FROM hotlunch_order_header WHERE school_num = $school_num AND schedule_num = $schedule_num AND record_num = $order_num"); echo("Order Total ($order_num): $original -> $ototal\n"); } } } ?>