Hello everyone. I have been following different tutorials trying to make an online store but I have come across a problem. This code is giving me one of the errors and I do not understand why. I did see that this question was asked before, but the answer was never given on how the writter fixed the problem. The error that is being given is the:
echo "Data to render this page is missing.";
[php]<?php
// Script Error Reporting
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);
?>
<?php
// Check to see the URL variable is set and that it exists in the database
if (isset($_GET['id'])) {
// Connect to the MySQL database
include "storescripts/connect_to_mysql.php";
$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 output amount
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"]));
}
} else {
echo "That item does not exist.";
exit();
}
} else {
echo "Data to render this page is missing.";
exit();
}
mysql_close();
?>
<?php echo $product_name; ?>
<?php include_once("template_header.php");?>
![<?php echo $product_name; ?>]()
View Full Size Image
|
<?php echo $product_name; ?>
<?php echo "$".$price; ?>
<?php echo "$subcategory $category"; ?>
<?php echo $details; ?>
|
<?php include_once("template_footer.php");?>
[/php]