function checkIndividually() { #---------------------------------------------------------------------- global $competitionCondition, $chosenWhich; echo "<hr /><p>Checking <b>" . $chosenWhich . " individual results</b>... (wait for the result message box at the end)</p>\n"; #--- Get all results (id, values, format, round). $dbResult = mysql_query("\n SELECT\n result.id, formatId, roundId, personId, competitionId, eventId, result.countryId,\n value1, value2, value3, value4, value5, best, average\n FROM Results result, Competitions competition\n WHERE competition.id = competitionId\n {$competitionCondition}\n ORDER BY formatId, competitionId, eventId, roundId, result.id\n ") or die("<p>Unable to perform database query.<br/>\n(" . mysql_error() . ")</p>\n"); #--- Build id sets $countryIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Countries"))); $competitionIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Competitions"))); $eventIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Events"))); $formatIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Formats"))); $roundIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Rounds"))); #--- Process the results. $badIds = array(); echo "<pre>\n"; while ($result = mysql_fetch_array($dbResult)) { if ($error = checkResult($result, $countryIdSet, $competitionIdSet, $eventIdSet, $formatIdSet, $roundIdSet)) { extract($result); echo "Error: {$error}\nid:{$id} format:{$formatId} round:{$roundId}"; echo " ({$value1},{$value2},{$value3},{$value4},{$value5}) best+average({$best},{$average})\n"; echo "{$personId} {$countryId} {$competitionId} {$eventId}\n\n"; $badIds[] = $id; } } echo "</pre>"; #--- Free the results. mysql_free_result($dbResult); #--- Tell the result. noticeBox2(!count($badIds), "All checked results pass our checking procedure successfully.<br />" . wcaDate(), count($badIds) . " errors found. Get them with this:<br /><br />SELECT * FROM Results WHERE id in (" . implode(', ', $badIds) . ")"); }
function getAllEventIdsIncludingObsolete () { return getAllIDs(dbQuery("SELECT id FROM Events WHERE rank<1000 ORDER BY rank")); }