products page coding

hi,

i am trying to show my products page, but every time i go on it shows as “Data to render this page is missing”.
can someone tell me what is wrong with my coding??

product.php

<?php // This file is www.developphp.com curriculum material // Written by Adam Khoury January 01, 2011 // http://www.youtube.com/view_play_list?p=442E340A42191003 // 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");?>

thanks in advance

In future please place your code inside of code or PHP tags!

Are you specifying ID when you visit the page? e.g:

product.php?id=1

Sponsor our Newsletter | Privacy Policy | Terms of Service