title: How the heck do I return these arrays with actual values from the db? Keep on coming up blank
body: <p>So the ultimate goal is to print out products as objects in a table using functions from these classes, but the output is a table with the correct amount of rows/columns but they are blank. I've spent 3 hours trying to figure this out and I'm stumped. There's three files </p>
  
  <p>Product.php</p>
  
  <pre><code>&lt;?php
  
  class Product
  {
      protected $product_id;
  
      protected $product_name;
  
      protected $product_price;
  
      public function __construct($product_id,$product_name, $product_price = '')
      {
          $this-&gt;setProductID($product_id);
          $this-&gt;setProductName($product_name);
          $this-&gt;setProductPrice($product_price);
  
      }
  
  
      public function getProductID() {
          return $this-&gt;product_id;
      }
      public function getProductName() {
          return $this-&gt;product_name;
      }
  
      public function getProductPrice() {
          return $this-&gt;product_price;
      }
  
      public function setProductID($product_id)
      {
          $this-&gt;product_id = $product_id;
      }
      public function setProductName($product_name)
      {
          $this-&gt;product_name= $product_name;
      }
  
      public function setProductPrice($product_price)
      {
          $this-&gt;product_price= $product_price;
      }
  
  
  }
  </code></pre>
  
  <p>ProductMapper.php</p>
  
  <pre><code>&lt;?php
  
  class ProductMapper
  {
      public function getProducts()
      {
          $dbConn = getDbConnection();
  
          $stmt = $dbConn-&gt;prepare("SELECT * FROM product");
          $stmt-&gt;execute();
  
          $outArray = array();
  
          while ($row = $stmt-&gt;fetch()) {
              $outArray[] = new Product($row['product_id'], $row['product_name'], $row['product_cost']);
          }
  
          return $outArray;
      }
  }
  </code></pre>
  
  <p>and Index.php which is where it is outputted.</p>
  
  <pre><code>&lt;?php
  
  require('classes/functions.php');
  require('classes/Product.php');
  require('classes/ProductMapper.php');
  
  $productMapper = new ProductMapper();
  $rows = $productMapper-&gt;getProducts();
  
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Product&lt;/title&gt;
  
  
  &lt;/head&gt;
  &lt;body&gt;
  
  
      &lt;tbody&gt;
      &lt;?php
  
      foreach ($rows as $row) {
          echo "&lt;tr&gt;";
          echo "&lt;td&gt;{$row-&gt;getProductID($this)}&lt;/td&gt;";
          echo "&lt;td&gt;{$row-&gt;getProductName($id)}&lt;/td&gt;";
          echo "&lt;td&gt;{$row-&gt;getProductPrice($id)}&lt;/td&gt;";
          echo "&lt;/tr&gt;";
      }
      ?&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>