title: Trying to make an function call to an external file with PhP, MySQL using WAMP
body: <p>I'm sure there is a simple answer to this, but I have been fumbling with everything for almost a week now and surrender. I am trying to build a shopping cart app and every coding solution I build will work when I include the code on the same page, but when I try to use an external page to run the function it does not seem to return the data. I have tried various monitoring techniques to determine what it is happening.</p>
  
  <p>Here is the code for the main page:
      </p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  
      &lt;head&gt;
          &lt;title&gt;Cart Connection&lt;/title&gt;
          &lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
              &lt;p&gt;Will this display?&lt;/p&gt;
              &lt;p&gt;&lt;a href='&lt;?php echo "showCart.php?PHPSESSID=" . session_id() ?&gt;'&gt;View Cart&lt;/a&gt;&lt;/p&gt;
  
              &lt;?php
                  $Database = "L3TtL2B5DdY";
                  $Table = "tblProds";
  
                  if (isset($_SESSION['curCart']))
                      $Cart = unserialize($_SESSION['curCart']);
                  else
                  {
                      if (class_exists("shoppingCart"))
                      {
                          $Cart = new shoppingCart();
                          $Cart-&gt;setDatabase($Database);
                          echo ("&lt;p&gt;If statement ran successfully&lt;/p&gt;");
                      }
                      else
                          exit("&lt;p&gt;The shoppingCart class is not available!");
                  }
  
  
                  $Cart-&gt;setTable($Table);
                  $Cart-&gt;getProductList();
                  $_SESSION['curCart'] = serialize($Cart);
              ?&gt;
              &lt;p&gt;&lt;a href='&lt;?php echo "showCart.php?PHPSESSID=" . session_id() ?&gt;'&gt;View Cart&lt;/a&gt;&lt;/p&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the relevant code on the "shoppingCart.php" page:</p>
  
  <pre><code>&lt;?php
      class shoppingCart
      {
          private $dbConn = "";
          private $dbName = "";
          private $tableName = "";
          private $orders = array();
          private $orderTable = array();
  
          function _construct()
          {
              $this-&gt;dbConn = @new mysqli("localhost", "root", "");
                  if (mysqli_connect_errno()) 
                      die("&lt;p&gt;Unable to connect to the database server.&lt;/p&gt;" . "&lt;p&gt;Error Code " . 
                      mysqli_connect_errno() . ": " . mysqli_connect_error() . "&lt;/p&gt;");
          }
  
          public function setDatabase($Database)
          {
              $this-&gt;dbName = $Database;
              @$this-&gt;dbConn-&gt;select_db($this-&gt;dbName)
                  Or die("&lt;p&gt;Unable to select the database.&lt;/p&gt;" . "&lt;p&gt;Error code " . mysqli_errno($this-&gt;dbConn) . 
                  ": " . mysqli_error($this-&gt;dbConn) . "&lt;/p&gt;");
          }
  
          public function setTable($Table)
          {
              $this-&gt;tableName = $Table;
          }
  
          public function getProductList()
          {
              $sqlString = "SELECT prodID, prodName, prodPrice FROM $this-&gt;tableName";
              @$qryResult = $this-&gt;dbConn-&gt;query($sqlString)
                  Or die("&lt;p&gt;Unable to perform the query.&lt;/p&gt;" . "&lt;p&gt;Error code " . mysqli_errno($this-&gt;dbConn) . 
                  ": " . mysqli_error($this-&gt;dbConn) . "&lt;/p&gt;");
              echo "&lt;table width='100%' border='1'&gt;";
              echo "&lt;tr&gt;&lt;th&gt;Product ID&lt;/th&gt;&lt;th&gt;Product Name&lt;/th&gt;&lt;th&gt;Product Price&lt;/th&gt;&lt;th&gt;Select Item&lt;/th&gt;&lt;/tr&gt;";
              $row = $qryResult-&gt;fetch_row();
              do
              {
                  echo "&lt;tr&gt;&lt;td&gt;{$row[0]}&lt;/td&gt;";
                  echo "&lt;td&gt;{$row[1]}&lt;/td&gt;";
                  echo "&lt;td&gt;{$row[2]}&lt;/td&gt;";
                  echo "&lt;td&gt;&lt;a href='showCart.php?PHPSESSID=" . session_id() . "&amp;operation=addItem&amp;productID=" . $row[0] . 
  
  "'&gt;Add&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
                  $row = $qryResult-&gt;fetch_row();
              } while ($row);
              echo "&lt;/table&gt;";
          }
  
  ......
  ?&gt;
  </code></pre>
  
  <p>When I try to load the main page it will display the two <p></p> lines and that is all. I debugged all the errors when I first created the code and thought it would work. When I wrote the original version of this page I put the "connection" code on the same page and the table displayed fine, so I don't know what else it could be.
  I installed WAMP on my Windows XP box and it seems to work fine. I haven't touched the configuration files for any of the programs and all my other test code seems to work fine. It is just when I try to contact an external file.
  Any help would be greatly appreciated as I think my brain is turning to mush.
  Thanks</p>