<?php #Goes through and tests whether all Campuses are returning Terms require_once '../includes/autoloads.php'; $problem_ids = array(); //Get the campuses... $conn = connect(); $all_campuses_query = 'SELECT Campus_ID FROM Campuses'; $result = mysql_query($all_campuses_query, $conn); while ($row = mysql_fetch_assoc($result)) { //Query the campus $query = next_dropdowns_query(array('campus' => $row['Campus_ID'])); $campus_result = mysql_query($query, $conn); if (mysql_num_rows($campus_result) == 0) { $problem_ids[] = $row['Campus_ID']; } else { $campus_row = mysql_fetch_assoc($campus_result); if (!$campus_row['Term_ID']) { update_classes_from_bookstore($campus_row); $campus_result = mysql_query($query, $conn); if (mysql_num_rows($campus_result) == 0) { $problem_ids[] = $row['Campus_ID']; } else { $campus_row = mysql_fetch_assoc($campus_result); if (!$campus_row['Term_ID']) { $problem_ids[] = $row['Campus_ID']; } } } } }
if (isset($_GET[$dd])) { $sent_dd++; } else { break; } } $sent_dd--; //lazy hack $sent_name = $dd_array[$sent_dd]; $sent_val = $_GET[$sent_name]; if (!valid_ID($sent_val)) { $json['status'] = 'Error: Invalid ' . $sent_name . ' id = ' . $sent_val; } else { //begin by checking if they're in the DB already $start = microtime(true); $query = next_dropdowns_query(array($sent_name => $sent_val)); $end = microtime(true); $json['first_query_time'] = round($end - $start, 3) * 1000; if (!($result = mysql_query($query))) { $json['status'] = 'Error: SQL query based on ' . $sent_name . '=' . $sent_val . ' yielded error: ' . mysql_error(); } else { if (mysql_num_rows($result) == 0) { $json['status'] = 'Error: SQL query based on ' . $sent_name . '=' . $sent_val . ' yielded no results'; } else { $next_name = $names_array[$sent_dd + 1]; $next_id = $ids_array[$sent_dd + 1]; $row = mysql_fetch_assoc($result); if (!$row[$next_id]) { $start = microtime(true); mysql_close($conn); update_classes_from_bookstore($row);