Thank you again Blaw....
You should have seen me jump up and down when it finally worked....
I was able to get this to work exactly as I wanted, I was even able to use the $_GET['year'] to work in my include statement!!
Which made the coding the output page nice and easy.
Now I'm still having a problem pulling the data from my data base 1/2 of the time. The following script works great for odd numbers (i.e. 1991. 1993, 1995, and so forth), but if I try to grab an even year (i.e. 1990, 1992, 1994, and so forth) nothing is displayed not even the error message....
<?php
//Log on to Database
$host = "localhost";
$user = "username";
$pass = "pass";
$dbname = "db name";
$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
//query for data from class field
$year = $_GET['year'];
$result = mysql_query("SELECT * FROM address WHERE Class='$year'");
if ($header = mysql_fetch_array($result)) {
//create table
echo "<table align=center border=0 cellpadding=0 cellspacing=0>\n";
//echo "<tr><td align=center><strong>%s</strong><hr></td></tr>\n", $header["Class"]);
printf( "<tr><td align=center><strong>%s</strong><hr></td></tr>\n", $header["Class"]);
do {
//write data from class field to new table
printf("<tr><td align=center><br>%s %s</td></tr>\n", $header["First"], $header["Last"]);
} while ($header = mysql_fetch_array($result));
//if there is no data in the db user will get this error
} else {
//echo "Sorry, no one from $year is registered in the alumni database"
printf( "Sorry, no one from<strong> $year </strong>has registered in the alumni database\n", $header["Class"]);
echo "</table>\n";
}
?>
Like I said this works great for any odd numbered year.
Any idea what would cause this to happen? I tried changing the field in my DB to int and year(4), but it didn't solve the problem.
Thank you for your time.