East Toronto Web Design Meetup

This is the web page that accompanies the lecture given on May 29, 2010. You can view the complete presentation at the following url:
http://shinyorange.tv/index.php?customer_id=5&recording_id=134

You may download the completed files from here.

includes/config.php

<?php
$dbhost='localhost';
$dbuser='USERNAME';
$dbpass='PASSWORD';
$dbname='DATABASE';

// CONNECT TO THE DATABASE SERVER
$link = mysql_connect($dbhost, $dbuser, $dbpass);

// IF THERE ARE ERRORS, DISPLAY THEM AND EXIT
if (!$link) {
    die('Error connecting to server: ' . mysql_error());
}

// CONNECT TO THE SPECIFIED DATABASE
$db_selected = mysql_select_db($dbname, $link);

// IF THERE ARE ERRORS, DISPLAY THEM AND EXIT
if (!$db_selected) {
    die ('Error selecting table: ' . mysql_error());
}
?>
		

test.php

<?php
include('includes/config.php');
$query = "
	SELECT
		name,
		email
	FROM
		subscribers
";

$result = mysql_query($query);
if(!$result) {
	die("Query Failed: <pre>$query\n\nError: " . mysql_error());
}
while ($row = mysql_fetch_assoc($result)) {
	echo "Name: $row[name], Email: $row[email]<br>";
}
?>
		

View the Test Page
Submit a new RSVP
List RSVPs