[SOLVED] Blank page when retrieving values
Posted: Fri May 27, 2005 5:46 am
I'm having a problem with the following script. I have a script that lists the categories in the database and then the items that are in that category, which is working fine.
But then when I select the item from the category to display it in more detail the script just displays a blank screen with no errors or anything. Here is the script:
The database field and table names are all correct, so I have no idea what is going on, could anyone help.
Thanks
But then when I select the item from the category to display it in more detail the script just displays a blank screen with no errors or anything. Here is the script:
Code: Select all
<?php
//validate item
$get_item = "select c.cat_name, si.item_name, si.item_price,
si.item_desc si.item_image from store_items as si left join
store_categories as c on c.id = si_cat_id where si.id = $_GET['item_id']";
$get_item_res = mysql_query($get_item) or die(mysql_error());
if (mysql_num_rows($get_item_res) < 1) {
//invalid item
$cat_name = strtoupper(stripslashes(mysql_result($get_item_res,0,'cat_name')));
$item_name = stripslashes(mysql_result($get_item_res,0,'item_name'));
$item_price = mysql_result($get_item_res,0,'item_price');
$item_desc = stripslashes(mysql_result($get_iem_res,0,'item_desc'));
$item_image = mysql_result($get_item_res,0,'item_image');
//make breadcrumb trail
$display_block .= "<p><strong><em>You are viewing:</em><br>
<a href=\"seestore.php?cat_id=$cat_id\">$cat_name</a>
> $item_name</strong></p>
<table cellpadding=3 cellspacing=3>
<tr>
<td valign=middle align=center><img src=\"$item_image\"></td>
<td valign=middle><p><strong>Description:</strong><br>$item_desc</p>
<p><strong>Price:</strong> £$item_price</p>";
//get colours
$get_colours = "select shirt_colour from store_shirts where
item_id = $item_id order by shirt_colour";
$get_colours_res = mysql_query($get_colours) or die(mysql_error());
if (mysql_num_rows($get_colours_res) > 0) {
$display_block .= "<p><strong>Available Colours:</strong><br></p>";
while ($colours = mysql_fetch_array($get_colours_res)) {
$shirt_colour = $colours['shirt_colour'];
$display_block .= "$shirt_colour<br>";
}
}
//get sizes
$get_sizes = "select shirt_size from store_shirts where
item_id = $item_id order by shirt_size";
$get_sizes_res = mysql_query($get_sizes) or die(mysql_error());
if (mysql_num_rows($get_sizes_res) > 0) {
$display_block .= "<p><strong>Available Sizes:</strong><br></p>";
while ($sizes = mysql_fetch_array($get_sizes_res)) {
$shirt_size = $sizes['shirt_size'];
$display_block .= "$shirt_size<br>";
}
}
$display_block .= "
</td>
</tr>
</table>";
}
?>Thanks