$database='ko2010';
$user='ko2010';
$password='c%AZuKP4NS';
$conn = mysql_connect(":/var/lib/mysql/mysql.sock", $user, $password);
mysql_select_db($database);
$result = mysql_query("select count(*) from ko2010");
$number_of_athletes = mysql_result($result, 0);
print "
";
print "Ladies and gentlemen, I am proud to present the following $number_of_athletes athletes as competitors in the 2010 Knitting Olympics!
";
print "
";
$result = mysql_query("select name, email, site, project, finished from ko2010 order by name");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
$counter = 0;
while ($row = mysql_fetch_assoc($result)) {
$counter += 1;
if ( $counter % 5 == 0 ) {
print "
";
}
if ( $row["finished"] == 1 ) {
print '
';
}
$site = $row["site"];
$project = $row["project"];
if ( $site != '' && $site != 'http://') {
print ("");
}
echo $row["name"]." -- ".$project;
if ( $site != '' ) {
print ('');
}
echo "
\n";
}
mysql_close($conn);
?>