I am putting the finsihing touches on my final project for class and it is an ecom site that also allows you to log in and view previous orders. Well it only pulls 1 entry from the database even if there are 3 entries, I am not sure what is wrong with my code as to why it won't pull all the entries. Here is the code:
PHP Code:<?php
//assumes that opendbo called, and session started when call is made.
function displayorders() {
global $order, $order_id, $p_id, $username, $quantity, $cart, $DBname, $link, $totalprice;
print ("Username:");
print (" ");
print $_SESSION['username'];
print ("<br><br>");
print ("<table>");
print ("<tr><td> Product ID </td> <td> Product Name </td><td> Quantity </td></tr>");
$query="SELECT * FROM ordereditems WHERE username='{$_SESSION['username']}'";
$result = mysql_query($query);
if (SqlNumRows($result) > 0) {
$result = mysql_db_query($DBname, $query, $link) or die($sql);
$p_id = mysql_result($result,0,"p_id");
$p_name = mysql_result($result,0,"p_name");
$quantity= mysql_result($result,0,"quantity");
print ("<tr><td> $p_id </td> <td> $p_name </td><td> $quantity </td> </td> ");
print ("<tr><td>   </td> <td>   </td><td>   </td> </td> ");
}
print("<tr> <td> TOTALS </td> <td> </td> <td> $quantity items</td><td> $totalpricef </td></tr> </table>");
}
?>



You saved this students life 
Bookmarks