Okay, I know I asked this before, got the perfect answer but my curious brain wanted to tweak it more. This code outputs the date from a date field in my database:
<?php
$display_date = mysql_query("SELECT date_FORMAT(date,'%m/%d/%Y') AS date FROM news WHERE id=$id")
or die ("MySQL Error");
if (mysql_num_rows($display_date) > 0)
{
while ($row = mysql_fetch_array($display_date))
{
$news_date = $row["date"];
echo ("News: $news_date");
};
}
else
{
echo("OOX ERROR: Bad Link");
}
?>
Let me fill you in, a user gets to a page titled news.php via a link that would be like this for example: http://domain.com/news.php?id=25. The code checks if the id=25 exists in the database, if it does, it goes on as normal. But what if the id variable was never mentioned in the hyperlink? All the user would get is a blank page... PHP dillema: Page in Distress. This is where you come in... HELP! How would I fix this? How would I display an error if an ID wasn't specified? Do you get me?