Swimmer Details

[insert_php]

//Check for a valid membership number, through GET OR POST
if ( (isset($_GET[‘id’])) ) {
$id = $_GET[‘id’];
}
elseif ( (isset($_POST[‘id’])) ) {
$id = $_POST[‘id’];
} else { //No valid membership number, kill the script.
echo ‘

Ooops.. looks like you made a mistake! Best go back…

‘;
exit();
}

include(‘/websites/ma/manlyswimclub.org.au/wp/wp-includes/variables.inc’);
$keyword = $_POST[‘keyword’];
$return_url = $_POST[‘return_url’];
$current_url = $_SERVER[“REQUEST_URI”];

require_once(‘/websites/ma/manlyswimclub.org.au/wp/wp-includes/mysqli_connect.php’); //Connect to the DB

$q = “SELECT membership_number,firstname, lastname, DATE_FORMAT(dob, ‘%Y’) AS dob, sex, category FROM $swimmer_table WHERE membership_number=$id”;

$r = @mysqli_query ($dbc, $q);

$num =@mysqli_num_rows($r);

if ($num>0) { // If it ran OK.

while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {

echo ‘

Membership No.: ‘ . $row[‘membership_number’] . ‘
Name: ‘ . $row[‘firstname’] . ‘ ‘ . $row[‘lastname’] . ‘
Date of Birth: ##-##-‘ . $row[‘dob’] . ‘
Sex: ‘ . $row[‘sex’] . ‘
Age Category: ‘ . $row[‘category’] . ‘

‘;

} // End of WHILE loop

echo ‘

If your year of birth is incorrect or you believe your Age Category to be incorrect please contact info@manlyswimclub.org.au to be updated.

‘;

echo ‘


‘;

mysqli_free_result($r); // Free up the resources.

} else { // If it did not run OK.

echo ‘

‘ . mysqli_error($dbc) . ‘
Query: ‘ . $q . ‘

‘; // Debugging Message.

}

mysqli_close($dbc); //Close the connection to the data

[/insert_php]