I am relatively new to using PHP, and I have what may be a very basic question on setting up something when no data is found in the mySQL table the script is pulling from. I have the following php page:
<?php
$link = mysql_connect("mysql.xxx.com", "xyz", "xyz");
if (!$link) echo "Failed to connect to MySQL Server!";
$status = mysql_select_db("xyz");
if (!$status) echo "Failed to select database!";
$dateresult = mysql_query("SELECT date, concat(year(date), date_format(date, \"%m\"), date_format(date, \"%d\"), \".pdf\") AS URL FROM meeting WHERE (date >= NOW()) ORDER BY date LIMIT 1;", $link);
if (!$dateresult) echo "The MySQL dates query failed!";
$daterow = mysql_fetch_object($dateresult);
header("Location: [url]http://[/url]" . $SERVER['HTTP_HOST']
. dirname($SERVER['PHP_SELF'])
. "pdf/Agenda/"
. $daterow->URL);
// Release the Dates Result Set
mysql_free_result($dateresult);
// Close the connection
mysql_close($link);
?>
If the $dateresult= line does not find a date greater than today's date in the file name of the .pdfs in the /pdf/agenda/ directory, the user gets the standard "404" error page.
What I would like to do instead is have them forwarded to a different page (just a basic web page with the site's design) saying that the Meeting Agenda file that they are looking for is not yet available.
Any direction would be greatly appreciated.
thanks