PHP script doesn't display item description

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KevinCB
Forum Commoner
Posts: 32
Joined: Tue Mar 01, 2005 6:00 am

PHP script doesn't display item description

Post 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
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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'));
Post Reply