title: Using multiple tables to show products from a cart page
body: <p>I've managed to get one stock table to display in the cart page when the user selects an item to purchase but I can't figure out how to get more than one table from different pages to display.
  Any help would be appreciated!</p>
  
  <pre><code>    &lt;?php
     session_start();
     $cart=$_SESSION["cart"];
  
     extract($_POST);
     if (IsSet($productid)||IsSet($_SESSION["notempty"])) $empty=false;
     else $empty=true;
  
     if (!$empty)
     {
        if (IsSet($cart[$productid])) $cart[$productid]+=$quantity;
        else $cart[$productid]=$quantity;
        $_SESSION["notempty"]=true;
     }
  
     $_SESSION["cart"]=$cart;
  
     $conn=mysql_connect("","");
     mysql_select_db("webent",$conn);
     mysql_query("CREATE TABLE Stock (stock_ID INT(3) NOT NULL PRIMARY KEY AUTO_INCREMENT,
                                      itemName VARCHAR(50),itemDesc VARCHAR(100),
                                      itemImage VARCHAR(10),itemStock VARCHAR(3),
                                      itemPrice VARCHAR(5))");
  ?&gt;
  
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"&gt;
  
  &lt;head&gt;
     &lt;title&gt;Jus' Books&lt;/title&gt;
     &lt;link href="style2.css" rel="stylesheet" type="text/css" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div id="container"&gt;
  
     &lt;div id="masthead"&gt;
  
     &lt;/div&gt;
  
     &lt;div id="navigation"&gt;
        &lt;p&gt;&lt;a href="index1.php"&gt;Home&lt;/a&gt;
        &lt;a href="fiction.php"&gt;Fiction&lt;/a&gt;
        &lt;a href="travel.php"&gt;Travel&lt;/a&gt;
        &lt;a href="sport.php"&gt;Sport&lt;/a&gt;
        &lt;a href="arts.php"&gt;Arts &amp; Design&lt;/a&gt;
        &lt;a href="cart.php"&gt;Shopping Cart&lt;/a&gt;
        &lt;a href="account.php"&gt;Manage Account&lt;/a&gt;&lt;/p&gt;
     &lt;/div&gt;
  
     &lt;div id="content"&gt;
  
        &lt;?php
  
        if ($empty) echo "&lt;h4&gt;Your shopping cart is empty&lt;/h4&gt;";
        else
        {
           echo "&lt;h4&gt;Your shopping cart contains:&lt;/h4&gt;";
           $total="";
           foreach ($cart as $id=&gt;$no)
           {
              if ($id!="")
              {
                 $result=mysql_query("SELECT * FROM Stock WHERE stock_ID= $id");
                 $row=mysql_fetch_array($result);
                 extract($row);
  
  
  
                 if ($itemStock&lt;$no) $no=$itemStock;
  
                 echo "&lt;p&gt;$no units of item $itemName at $itemPrice each&lt;/p&gt;";
              }
              $total+=$no*$itemPrice;
           }
           echo "&lt;p&gt;Total to pay: £$total&lt;/p&gt;";
        }
  
        ?&gt;
  
        &lt;a href="index1.php"&gt;Continue Shopping&lt;/a&gt;
        &lt;a href="checkout.php"&gt;Proceed to Checkout&lt;/a&gt;
        &lt;p&gt;&lt;/p&gt;
  
     &lt;/div&gt;
  
     &lt;div id="footer"&gt;
        &lt;p&gt;&lt;a href="index1.php"&gt;Home&lt;/a&gt; | 
        &lt;a href="fiction.php"&gt;Fiction&lt;/a&gt; |
        &lt;a href="travel.php"&gt;Travel&lt;/a&gt; |
        &lt;a href="sport.php"&gt;Sport&lt;/a&gt; |
        &lt;a href="arts.php"&gt;Arts &amp; Design&lt;/a&gt; |
        &lt;a href="cart.php"&gt;Shopping Cart&lt;/a&gt; |
        &lt;a href="account.php"&gt;Manage Account&lt;/a&gt;&lt;/p&gt;
     &lt;/div&gt;
  
  &lt;/div&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>The other tables have the exact same fields but have the name Stock_Travel
  Stock_Sport
  Stock_Arts    </p>