Anyone help me? this is probably quite simple but I'm pretty new to PHP.
All I want to do it loop through some DB records and display them in the
format written in this PHP file:
Anyone see where I'm going wrong? the error I get says:
Warning: Unable to jump to row 0 on MySQL result index 2

<?

$dbreturn = mysql_query("SELECT * FROM Items WHERE ItemID = '$ItemID'");
//debug
echo mysql_error();
$ItemHits                       = mysql_numrows($dbreturn);
$ItemID             = mysql_result($dbreturn ,$i,"ItemID");
$ImageName                      = mysql_result($dbreturn ,$i,"ImageName");
$ItemName                       = mysql_result($dbreturn ,$i,"ItemName");
$ItemSKU                        = mysql_result($dbreturn ,$i,"ItemSKU");
$ItemCost                       = mysql_result($dbreturn ,$i,"ItemCost");
$ItemDescription                        = mysql_result($dbreturn 
,$i,"ItemDescription");
for ($i=0; $i < $ItemHits; $i++)
//($i < $ItemHits)
{
$row = mysql_fetch_array($dbreturn);
echo "<table width='400' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td><img src='images/$ImageName' width='175'></td>";
echo "<td valign='top'>";
echo "<table width='225' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td><span class='pikkuleipa'>Product Name:</span></td>";
echo "<td><span class='pikkuleipa'>$ItemName</span></td>";
echo "</tr>";
echo "<tr>";
echo "<td><span class='pikkuleipa'>Product Code:</span></td>";
echo "<td><span class='pikkuleipa'>$ItemSKU</span></td>";
echo "</tr>";
echo "<tr>";
echo "<td><span class='pikkuleipa'>Unit price:</span></td>";
echo "<td><span class='pikkuleipa'>$ItemCost</span></td>";
echo "</tr>";
echo "<tr>";
echo "<td><span class='pikkuleipa'><b>Description</b></span><br></td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<table width='225' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td><span class='pikkuleipa'>$ItemDescription</span></td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "<form method='post' action='$Relative/addcart.php'>";
echo "<table width='400' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='175' align='right'><span class='pikkuleipa'>Quantity
Required:</span></td>";
echo "<td width='225'>";
echo "<INPUT TYPE='TEXT' Name='ItemQuantity' Value='1' size='2'>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='175'></td>";
echo "<td width='225'><input type='image' border='0' name='submit'
src='images/add.gif'></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
//$i++;
}
?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to