So when you run the first file, you get "We have no products listed in Our store Yet"?
In the second file, here's the PHP code at the start, a bit more organized:
?php
// Check to see URL Variable is set and that it exists in the database
if (isset($_GET['id']))
{
$id = preg_replace('#[^0-9]#i', '', $_GET['id']);
//use this var to check to see if this ID Exists, if yes then get the product
//details, if no then exit this script and give message why.
$sql = mysql_query("SELECT * FROM products WHERE id='$id' LIMIT 1");
$productCount = mysql_num_rows($sql);//count the the output ammount
if ($productCount > 0)
{
// get all the product details
while($row = mysql_fetch_array($sql))
{
$product_name = $row["product_name"];
$price = $row["price"];
$details = $row["details"];
$category = $row["category"];
$subcategory = $row["subcategory"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); // Notice here how we changed it from _added to _Added
//product_name,price,details,category,subcategory,date_added
}
}
else
{
echo "That item does not exist.";
exit();
}
}
else
{
echo "No product in the database with that ID";
exit();
}
mysql_close();
?>
If you are getting the "No product in the database with that ID", according to your code, that means that you don't have an ID set in the url, like "products.php?id=1". You need to have an id set in order to use this page.