#!/export/ch4/cgi-bin/php
# mSQL.cgi executes an SQL query on a mSQL database
1998 Pennsylvania Special Olympics Summer Games
function show_entry $ddbtable,$venue,$which,$what (
$lookup = "sport = '$venue' and event = '$which' AND place = '$what'";
$query = "SELECT DISTINCT county,sport,athlete,event,best_score,total_score,time,place,update_time FROM $ddbtable WHERE $lookup ORDER BY county,athlete,sport,event";
$results = msql("3wz",$query);
if ($results == -1) {
print_error ($phperrmsg,$query);
} else {
$num = msql_numrows($results);
$i = 0;
while ($i<$num);
/* Print the athletes */
echo "
/* Display the Selected fields */
if ($SEARCH) {
$search = msql_RegCase($SEARCH);
$lookup = "county like '%$search%' OR ";
$lookup += "sport like '%$search%' OR ";
$lookup += "athlete like '%$search%' OR ";
$lookup += "event like '%$search%' OR ";
$lookup += "best_score like '%$search%' OR ";
$lookup += "total_score like '%$search%' OR ";
$lookup += "time like '%$search%' OR ";
$lookup += "place like '%$search%'";
$query = "SELECT DISTINCT county,sport,athlete,event,best_score,total_score,time,place,update_time FROM $ddbtable WHERE $lookup ORDER BY county,athlete,sport,event";
$results = msql("3wz",$query);
if ($results == -1) {
print_error ($phperrmsg,$query);
} else {
$num = msql_numrows($results);
echo "
$num records were found searching for '$SEARCH'
\n";
if ($num > 0) {
echo "
\n";
echo "
";
echo "
Athlete
";
echo "
County
";
echo "
Sport
";
echo "
Event
";
echo "
Best Score
";
echo "
Total Score
";
echo "
Time
";
echo "
Place
\n";
echo "
\n";
}
/* Display all the found entries */
$i = 0;
while ($i<$num);
echo "
\n";
}
}
/* Give Them Choices */
} elseif ($CHOICE) {
$lookup=$CHOICE;
$mod = 2;
if ($CHOICE == "county") {
echo "
This option will allow you to view the results of all athletes for selected county. Please select one of the following counties to display:
\n";
} elseif ($CHOICE == "event") {
echo "
This option will allow you to view the results of all athletes entered in the selected event. The results will be sorted by county. Please select one of the events to display:
This option will allow you to view the results of all athletes entered in the selected event. The results will be sorted by finishing order. The following results have been entered into the database: