County Competitions

[insert_php]
function getCompetitions($organiser)
{try {
$connection = new PDO(getConnString(), getUser(), getpw());
$sql = “SELECT name, type, gender, notes FROM competitions WHERE organiser = ‘$organiser'”;
echo “

    “;
    foreach ($connection->query($sql) as $row)
    {
    echo “

  • “;
    $name = $row[‘name’];
    $output = $output = “$name“;
    $output .=” (“.$row[‘type’].”, open to “.$row[‘gender’];
    $notes = $row[‘notes’];
    if(!empty($notes) && isset($notes) && !is_null($notes))
    {
    $output .= “, $notes”;
    }
    $output .= “)
  • “;
    echo $output;
    }
    echo “

“;
$connection = null;
}
catch(PDOException $e) { echo $e; }
}
getCompetitions(“North Midlands”);
[/insert_php]