Page 1 of 1

PHP script doesn't display item description

Posted: Fri Jun 17, 2005 9:44 am
by KevinCB
I've got a problem with a script that lists items from a table, it returns all of the values apart from the descriptions of the items, and I can't understand why. Here is a small part of the script.

Code: Select all

<?php
session_start();

$display_block .= "<h1>Shoot The Moon Records - Item Detail</h1>";

//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
   $display_block .= "<p><em>Invalid item selection.</em></p>";
} else {
   $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>
	 <form method=post action=\"addtocart.php\">";
Could anyone take a look?

Thanks

Posted: Fri Jun 17, 2005 10:07 am
by JayBird
missed a 't' in this line

Code: Select all

$item_desc = stripslashes(mysql_result($get_iem_res,0,'item_desc'));
should be

Code: Select all

$item_desc = stripslashes(mysql_result($get_item_res,0,'item_desc'));