Jump to content

Cannot get the page to render


zeusthegreat

Recommended Posts

index.php

 

 

?php

error_reporting(E_ALL);

ini_set('display_errors', '1');

 

?>

 

 

<?php

// Run a select query to get my latest 6 items

//Connect to the MySQL database

include "storescripts/connect_to_mysql.php";

$dynamicList = "";

$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 6");

$productCount = mysql_num_rows($sql);//count the the output ammount

if ($productCount > 0){

while($row = mysql_fetch_array($sql)){

$id = $row["id"];

$price = $row["price"];

$details = $row["details"];

$product_name = $row["product_name"];

$date_added = strftime("%b %d, %Y", strtotime($row["date_Added"])); // Notice here how we changed it from _added to _Added

$dynamicList .= '<table width="100%" cellpadding="6">

<tr>

<td width="34%" valign="top"><a href="product.php?"><img style="border: #666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="$product_name" width="1//Connect to the MySQL database

include "storescripts/connect_to_mysql.php";20" height="113" border="1" /></a></td>

<td width="66%" valign="top"><p> ' . $product_name . '<br />

£ ' . $price . '<br />

' . $details . '<br />

<a href="product.php?id="inventory_images/' . $id . '.jpg">View product</a></p></td>

</tr>

</table>';

}

 

}else{

$dynamicList = "We have no products listed in our store Yet";

}

mysql_close();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">'>http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Store </title>

<link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />

<script type="text/javascript">

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

</script>

</head>

 

<body onload="MM_preloadImages('style/home-grey.gif','style/web-design-grey.gif','style/web-development-grey.gif','style/e-commerce-grey.gif','style/pricing-grey.gif')">

<div align="center" id="outerMainWrapper">

<div align="center" id="mainWrapper">

<?php include_once("template_Header.php");?>

<div id="headerNav"><table width="100%">

<tr>

 

</tr>

<tr>

<td><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('HOME','','style/home-grey.gif',1)"><img src="style/home.gif" alt="HOME" name="HOME" width="170" height="34" border="0" id="HOME" /></a></td>

<td><a href="web-design.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('WEB DESIGN','','style/web-design-grey.gif',1)"><img src="style/web-design.gif" alt="WEB DESIGN" name="WEB DESIGN" width="170" height="34" border="0" id="WEB DESIGN" /></a></td>

<td><a href="web-development.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('WEB DEVELOPMENT','','style/web-development-grey.gif',1)"><img src="style/web-development.gif" alt="WEB DEVELOPMENT" name="WEB DEVELOPMENT" width="170" height="34" border="0" id="WEB DEVELOPMENT" /></a></td>

<td><a href="e-commerce.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('E COMMERCE','','style/e-commerce-grey.gif',1)"><img src="style/e-commerce.gif" alt="E COMMERCE" name="E COMMERCE" width="170" height="34" border="0" id="E COMMERCE" /></a></td>

<td><a href="pricing.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('PRICING','','style/pricing-grey.gif',1)"><img src="style/pricing.gif" alt="PRICING" name="PRICING" width="170" height="34" border="0" id="PRICING" /></a></td>

</tr>

<tr>

 

</tr>

</table>

</div>

<?php include_once("template_Sidebar.php");?>

</div>

<div align="left" id="pageContent"><table width="98%">

<tr>

<td width="25%" valign="top">Template</td>

<td width="49%" valign="top"><p>Newest Items added to the store</p>

<p><?php echo $dynamicList; ?></p>

<!--<table width="100%" cellpadding="6">

<tr>

<td width="34%" valign="top"><a href="product.php?"><img style="border: #666 1px solid;" src="inventory_images/21.jpg" alt="$dynamicTitle" width="120" height="113" border="1" /></a></td>

<td width="66%" valign="top"><p>product Title<br />

product price<br />

product details<br />

<a href="product.php?">View product</a></p></td>

</tr>

</table> -->

<p> </p>

<!--<table width="92%" height="106" cellpadding="4">

<tr valign="top">

<td width="23%"><img src="../Picture1.gif" width="1" height="1" /><img src="../Picture1.gif" width="1" height="1" alt="$dynamicTitle" /><a href="product.php?"><img style="border-color: #999" src="inventory_images/21.jpg" alt="$dynamicTitle" width="70" height="70" border="1" /></a></td>

<td width="77%"><p>product title<br />

product price<br />

product details

<br />

<a href="Product.php">View product</a></p></td>

</tr>

</table> -->

<p> </p>

<p> </p>

<p> </p>

<p> </p></td>

<td width="26%" valign="top">Large templates</td>

</tr>

</table>

</div>

<?php include_once("template_Footer.php");?>

</div>

</div>

</body>

</html>

 

this page seems to work ok just wondering if links ok though

 

 

product.php

<?php

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 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 "Data to render this page is missing";

exit();

 

 

 

 

 

 

}

mysql_close();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><?php echo $product_name; ?> </title>

<link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />

<script type="text/javascript">

function MM_swapImgRestore() { //v3.0

var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

}

function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_findObj(n, d) { //v4.01

var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_swapImage() { //v3.0

var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}

</script>

</head>

 

<body onload="MM_preloadImages('style/home-grey.gif','style/web-design-grey.gif','style/web-development-grey.gif','style/e-commerce-grey.gif','style/pricing-grey.gif')">

<div align="center" id="outerMainWrapper">

<div align="center" id="mainWrapper">

<?php include_once("template_Header.php");?>

<div id="headerNav"><table width="100%">

<tr>

 

</tr>

<tr>

<td><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('HOME','','style/home-grey.gif',1)"><img src="style/home.gif" alt="HOME" name="HOME" width="170" height="34" border="0" id="HOME" /></a></td>

<td><a href="web-design.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('WEB DESIGN','','style/web-design-grey.gif',1)"><img src="style/web-design.gif" alt="WEB DESIGN" name="WEB DESIGN" width="170" height="34" border="0" id="WEB DESIGN" /></a></td>

<td><a href="web-development.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('WEB DEVELOPMENT','','style/web-development-grey.gif',1)"><img src="style/web-development.gif" alt="WEB DEVELOPMENT" name="WEB DEVELOPMENT" width="170" height="34" border="0" id="WEB DEVELOPMENT" /></a></td>

<td><a href="e-commerce.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('E COMMERCE','','style/e-commerce-grey.gif',1)"><img src="style/e-commerce.gif" alt="E COMMERCE" name="E COMMERCE" width="170" height="34" border="0" id="E COMMERCE" /></a></td>

<td><a href="pricing.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('PRICING','','style/pricing-grey.gif',1)"><img src="style/pricing.gif" alt="PRICING" name="PRICING" width="170" height="34" border="0" id="PRICING" /></a></td>

</tr>

<tr>

 

</tr>

</table>

</div>

<?php include_once("template_Sidebar.php");?>

</div>

<div align="left" id="pageContent"><table width="84%">

<tr>

<td valign="top"><table width="100%" cellpadding="6">

<tr>

<td width="33%" valign="top"><p><img src="inventory_images/<?php echo $id; ?>.jpg" alt="<?php echo $product_name; ?>" width="84" height="140" border="1" /></p>

<p><a href="inventory_images/<?php echo $id; ?>.jpg">View full size image</a></p></td>

<td width="67%" valign="top"><?php echo $product_name; ?><br />

<?php echo $price; ?><br />

<?php echo "$subcategory $category"; ?><br />

<?php echo $details; ?><br />

<br />

<br />

ADD TO CART</td>

</tr>

</table>

<p> </p>

<!-- <p><?php echo $dynamicList; ?></p> -->

<!--<table width="100%" cellpadding="6">

<tr>

<td width="34%" valign="top"><a href="product.php?"><img style="border: #666 1px solid;" src="inventory_images/21.jpg" alt="$dynamicTitle" width="120" height="113" border="1" /></a></td>

<td width="66%" valign="top"><p>product Title<br />

product price<br />

product details<br />

<a href="product.php?">View product</a></p></td>

</tr>

</table> -->

<p> </p>

<!--<table width="92%" height="106" cellpadding="4">

<tr valign="top">

<td width="23%"><img src="../Picture1.gif" width="1" height="1" /><img src="../Picture1.gif" width="1" height="1" alt="$dynamicTitle" /><a href="product.php?"><img style="border-color: #999" src="inventory_images/21.jpg" alt="$dynamicTitle" width="70" height="70" border="1" /></a></td>

<td width="77%"><p>product title<br />

product price<br />

product details

<br />

<a href="Product.php">View product</a></p></td>

</tr>

</table> -->

<p> </p>

<p> </p>

<p> </p>

<p> </p></td>

</tr>

</table>

</div>

<?php include_once("template_Footer.php");?>

</div>

</div>

</body>

</html>

 

 

 

 

i try to open this page through a browser and keep getting this error at top of the page

 

 

Data to render this page is missing

 

 

then when i try to view it on the indexpage though a link

 

i get this message

That item does not exist

 

 

and when i try to click the link on the picture i get

 

 

 

Data to render this page is missing

 

 

 

 

 

 

 

 

 

 

 

it is almost as if $_GET is not working

 

 

what really maddens me is at 4 oclock yesterday i had it working perfectly, but i messed up tinkering around with it

 

 

please help as i just want to return to yesterdays glory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...