[insert_php] printf(“
“);
printf(“

\n”);
printf(“

\n”);
printf(“

— Select from the following options–

\n”);
printf(“
“);
printf(““);
printf(“

\n”);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
# printf(“

“);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf ( “

\n” );
printf ( “

\n” );

printf(“

\n”);
printf(“

\n” );
printf ( “

\n” );
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf( “

\n” );

printf ( “

\n” );
$query=”SELECT * FROM clubs ORDER BY name”;
$clubs = mysql_query($query);
$num_clubs = mysql_num_rows($clubs);
printf(“

\n” );
printf ( “

\n” );
printf ( “

\n” );
printf( “

\n” );

printf ( “

\n” );

printf ( “

\n” );

printf(“

\n”);
printf(“

” );
if ( strlen( $hist ) == 0 or $hist == “C” )
{
printf ( “ Current
” );
printf ( “ History
” );
}
else
{
printf ( “ Current
” );
printf ( “ History
” );
}
printf ( “
” );

if ( strlen( $type ) == 0 or $type == “0” )
{
printf ( “ Individual
” );
printf ( “ Relay” );
}
else
{
printf ( “ Individual
” );
printf ( “ Relay” );
}

printf ( “

“);
if (strlen($course) == 0 or $course == “LC”)
{
printf(“Long Course
“);
printf(“Short Course”);
}
else
{
printf(“Long Course
“);
printf(“Short Course”);
}
printf(“
“);
if ( strlen( $gender ) == 0 or $gender == “F” )
{
printf ( “ Female
” );
printf ( “ Male
” );
printf ( “ Mixed” );
}
else if ( $gender == “M” )
{
printf ( “ Female
” );
printf ( “ Male
” );
printf ( “ Mixed” );
}
else if ( $gender == “X” )
{
printf ( “ Female
” );
printf ( “ Male
” );
printf ( “ Mixed” );
}
printf ( “
Age Group
” );

printf ( “” );
printf ( “All“, IsSelected( “All”, $group ) );
printf ( “5 and Under“, IsSelected( “5-U”, $group ) );
printf ( “6yrs“, IsSelected( “6”, $group ) );
printf ( “7yrs“, IsSelected( “7”, $group ) );
printf ( “8yrs“, IsSelected( “8”, $group ) );
printf ( “9yrs“, IsSelected( “9”, $group ) );
printf ( “10yrs“, IsSelected( “10”, $group ) );
printf ( “11yrs“, IsSelected( “11”, $group ) );
printf ( “12yrs“, IsSelected( “12”, $group ) );
printf ( “13yrs“, IsSelected( “13”, $group ) );
printf ( “14yrs“, IsSelected( “14”, $group ) );
printf ( “15yrs“, IsSelected( “15”, $group ) );
printf ( “Junior“, IsSelected( “15-U”, $group ) );
printf ( “Senior“, IsSelected( “16-O”, $group ) );
printf ( “Open“, IsSelected( “Open”, $group ) );
printf ( “

\n”);
printf(“\n”);
printf(“All Distances\n”, IsSelected(‘All’, $dist));
printf(“25m\n”, IsSelected(’25’, $dist));
printf(“33m\n”, IsSelected(’33’, $dist));
printf(“50m\n”, IsSelected(’50’, $dist));
printf(“100m\n”, IsSelected(‘100’, $dist));
printf(“200m\n”, IsSelected(‘200’, $dist));
printf(“400m\n”, IsSelected(‘400’, $dist));
printf(“800m\n”, IsSelected(‘800’, $dist));
printf(“1500m\n”, IsSelected(‘1500’, $dist));
printf(“
\n” );
printf( “\n” );
printf( “All Strokes\n”, IsSelected( ‘All’, $stroke ) );
printf( “Freestyle\n”, IsSelected( ‘0’, $stroke ) );
printf( “Backstroke\n”, IsSelected( ‘1’, $stroke ) );
printf( “Breaststroke\n”, IsSelected( ‘2’, $stroke ) );
printf( “Butterfly\n”, IsSelected( ‘3’, $stroke ) );
printf( “Medley\n”, IsSelected( ‘4’, $stroke ) );
printf( “
Name ” );
printf ( “” );
printf ( “
” );
printf(“\n”);
printf(“All Clubs\n”);
for ($i=0; $i < $num_clubs; $i++) { $row = mysql_fetch_array($clubs); printf("%s\n”, $row[“index”], IsSelected($row[“index”], $filter), $row[“name”]);
}
printf ( “
Sort By
” );
printf( “\n” );
printf( “Age-Distance-Stroke\n”, IsSelected( ‘0’, $sorton ) );
printf( “Age-Stroke-Distance\n”, IsSelected( ‘1’, $sorton ) );
printf( “Stroke-Distance-Age\n”, IsSelected( ‘2’, $sorton ) );
printf( “Name\n”, IsSelected( ‘3’, $sorton ) );
printf( “Date\n”, IsSelected( ‘4’, $sorton ) );
printf( “
” );
printf ( “\n” );
printf ( “” );
printf ( “\n” );
printf ( “

\n”);
if ( isset( $_GET[ “hist” ] ) )
{
$hist = $_GET[ “hist” ];
$type = $_GET[ “type” ];
$course = $_GET[ “course” ];
$gender = $_GET[ “gender” ];
$group = $_GET[ “group” ];
$filter = $_GET[ “filter” ];
$type = $_GET[ “type” ];
$holder = $_GET[ “holder” ];
$dist = $_GET[ “dist” ];
$stroke = $_GET[ “stroke” ];
$sorton = $_GET[ “sorton” ];

$query = “SELECT DATE_FORMAT(date, ‘%d-%m-%Y’) as fdate, givenname, surname, time, agebot, agetop, if(agetop, agetop, 99) as sortage, class, distance, course, sex, stroke, relay, description, clubs.sname as clubname, strokes.sname as strokename, pools.sname as poolname FROM (((records INNER JOIN clubs ON records.club = clubs.index) INNER JOIN strokes ON records.stroke = strokes.index) INNER JOIN pools ON records.venue=pools.index)”;
if ($hist==”C”)
{
$query = $query.” INNER JOIN (SELECT min(time) as minoftime, agebot as agebot1, agetop as agetop1, class as class1, distance as distance1, course as course1, sex as sex1, stroke as stroke1 FROM records GROUP BY sex1, agebot1, agetop1, class1, distance1, stroke1, course1 ORDER BY course1, sex1, stroke1, class1, agebot1, agetop1, distance1) as recs ON (time = minoftime) AND (agebot = agebot1) AND (agetop = agetop1) AND (class = class1) AND (distance = distance1) AND (course = course1) AND (sex = sex1) AND (stroke = stroke1)”;
$title = “Current”;
}
else
{
$title = “Historical”;
}
switch ($gender)
{
case “F”:
$sex=”1″;
$title = $title.” Female”;
break;
case “M”:
$sex=”0″;
$title = $title.” Male”;
break;
case “X”:
$sex=”2″;
$title = $title.” Mixed”;
break;
}
$query = $query.” WHERE records.sex = ‘$sex'”;
if ($course==”LC”)
{
$crse=”0″;
$title = $title.” LC Records”;
}
else
{
$crse=”1″;
$title = $title.” SC Records”;
}
$query = $query.” AND records.course = ‘$crse'”;
if ($type==”1″)
{
$query = $query.” AND records.relay = ‘1’”;
$title = $title.” – Relay”;
}
else
{
$query = $query.” AND records.relay = ‘0’”;
}
if ($dist!=”All”)
{
$query = $query.” AND records.distance = ‘$dist'”;
$title = $title.” – “.$dist.”m”;
}
if ($stroke!=”All”)
{
$query = $query.” AND records.stroke = ‘$stroke'”;
# $title = $title.” – “.$stroke;
}
$groupbits = explode(‘-‘, $group);
switch ($groupbits[0])
{
case “All”:
break;
case “Open”:
$query = $query.” AND records.class = 4″;
break;
case “U”:
$query = $query.” AND records.class = 1 AND records.agetop = “.$groupbits[1];
break;
case “O”:
$query = $query.” AND records.class = 3 AND records.agebot = “.$groupbits[1];
break;
case is_numeric($groupbits[0]):
$query = $query.” AND records.class = 0 AND records.agebot = “.$groupbits[0];
break;
}
if ($filter!=”All”)
{
$query = $query.” AND records.club = ‘$filter'”;
}
$holder = str_replace(“*”, “”, $holder);
$holder = str_replace(“%”, “”, $holder);
if (strlen($holder) != 0)
{
$query = $query.” AND records.surname REGEXP ‘”.$holder.”‘”;
}
switch ($sorton)
{
case “0”:
$orderby=”ORDER BY sortage, class, distance, stroke, date DESC”;
break;
case “1”:
$orderby=”ORDER BY sortage, class, stroke, distance, date DESC”;
break;
case “2”:
$orderby=”ORDER BY stroke, distance, sortage, class, date DESC”;
break;
case “3”:
$orderby=”ORDER BY surname, givenname, date DESC”;
break;
case “4”:
$orderby=”ORDER BY date DESC”;
break;
}

$query = $query. $orderby;

$result = mysql_query($query);
$num_results = mysql_num_rows($result);

printf(“

\n”);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

“);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
if ($type==”0″)
{
printf(“

\n”);
printf(“

\n”);
}
else
{
printf(“

\n”);
printf(“

\n”);
}
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
printf(“

\n”);
for ($i=0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); echo "

“;
}
printf(“

\n”);
printf(“
\n”);
printf(“%s\n”, $title);
printf(“
\n”);
printf(“Updated: %s\n”, $updated);
printf(“
Name Surname Club Pool
Date
Time
“;
switch ($row[“class”])
{
case “0” :
echo htmlspecialchars(stripslashes($row[“agebot”])).”yrs”;
break;
case “1” :
echo htmlspecialchars(stripslashes($row[“agetop”])).”yrs&U”;
break;
case “2” :
echo htmlspecialchars(stripslashes($row[“agebot”].”-“.$row[“agetop”]));
break;
case “3” :
echo htmlspecialchars(stripslashes($row[“agebot”])).”yrs&O”;
break;
case “4” :
echo “Open”;
break;
}
echo “
“;
echo htmlspecialchars(stripslashes($row[“distance”])).”m”;
echo “
“;
echo “
“;
echo htmlspecialchars(stripslashes($row[“strokename”]));
echo “
“;
if ($type==”0”)
{
echo htmlspecialchars(stripslashes($row[“givenname”]));
}
else
{
echo htmlspecialchars(stripslashes($row[“description”]));
}
echo “
“;
echo htmlspecialchars(stripslashes($row[“surname”]));
echo “
“;
echo htmlspecialchars(stripslashes($row[“clubname”]));
echo “
“;
echo htmlspecialchars(stripslashes($row[“poolname”]));
echo “
“;
echo htmlspecialchars(stripslashes($row[“fdate”]));
echo “
“;
echo htmlspecialchars(stripslashes($row[“time”]));
echo “

\n”);
}
[/insert_php]