title: PDO bindparam empty values
body: <p>When executing a PDO bindParam call the values being inserted into the DB are empty.</p>
  
  <p>Looking at the log the parameters don't appear to be transmitting</p>
  
  <pre><code>Prepare     INSERT INTO StockItemTypes SET  Name = ?, PartNumber = ?, BarCodeNumber = ?, LeadTimeWeeks = ?,  PriceGroupFK = ?, MinimumOrderQuantity = ?, ReorderPointOverride = ?,  MinimumStockLevelOverride = ?, CurrentQuantity = ?, ApplianceTypeFK = ?,  Rack = ?, Shelf = ?
  Execute     INSERT INTO StockItemTypes SET  Name = '', PartNumber = '', BarCodeNumber = '', LeadTimeWeeks = '',  PriceGroupFK = '', MinimumOrderQuantity = '', ReorderPointOverride = '',  MinimumStockLevelOverride = '', CurrentQuantity = '', ApplianceTypeFK = '',  Rack = '', Shelf = ''
  </code></pre>
  
  <p>The database is managed by a class that is known to work and does work on other areas of the site.</p>
  
  <p>I have also created a getQuery method on the class and when viewing that I get the SET commands present, but this just outputs what would be ran for debug purposes.</p>
  
  <p>I can't see any issues and no errors are triggered, any ideas?</p>
  
  <p>Insert Code</p>
  
  <pre><code>$query = "INSERT INTO StockItemTypes SET " . 
      " Name = :P_Name, PartNumber = :P_PartNumber, BarCodeNumber = :P_BarCodeNumber, LeadTimeWeeks = :P_LeadTimeWeeks, " . 
      " PriceGroupFK = :P_PriceGroup, MinimumOrderQuantity = :P_MinOrderQty, ReorderPointOverride = :P_ReorderPointOverride, " . 
      " MinimumStockLevelOverride = :P_MinimumStockLevelOverride, CurrentQuantity = :P_CurrentQuantity, ApplianceTypeFK = :P_ApplianceType, " . 
      " Rack = :P_Rack, Shelf = :P_Shelf;";
  
  $dbpars = parent::$DB-&gt;NewParamList();
  parent::$DB-&gt;addParam($dbpars, ':P_Name', $StockItemName);
  parent::$DB-&gt;addParam($dbpars, ':P_PartNumber', $PartNumber);
  parent::$DB-&gt;addParam($dbpars, ':P_BarCodeNumber', $Barcode);
  parent::$DB-&gt;addParam($dbpars, ':P_LeadTimeWeeks', $LeadTime);
  parent::$DB-&gt;addParam($dbpars, ':P_PriceGroup', $PriceGroup);
  parent::$DB-&gt;addParam($dbpars, ':P_MinOrderQty', $MinOrderQTY);
  parent::$DB-&gt;addParam($dbpars, ':P_ReorderPointOverride', $NewReOrderQTY);
  parent::$DB-&gt;addParam($dbpars, ':P_MinimumStockLevelOverride', $MinStockLevelOverride);
  parent::$DB-&gt;addParam($dbpars, ':P_CurrentQuantity', $CurrentStockQTY);
  parent::$DB-&gt;addParam($dbpars, ':P_ApplianceType', $ApplianceType);
  parent::$DB-&gt;addParam($dbpars, ':P_Rack', $Rack);
  parent::$DB-&gt;addParam($dbpars, ':P_Shelf', $Shelf);
  
  parent::$DB-&gt;Run($query, $dbpars);
  </code></pre>
  
  <p>DB Class</p>
  
  <pre><code>    public function Connect()
      {
          try 
          {
              $t = array(
                  PDO::ATTR_EMULATE_PREPARES =&gt; false, 
                  PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION, 
                  PDO::MYSQL_ATTR_USE_BUFFERED_QUERY =&gt; true
              );
  
              $this-&gt;db = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8', DB_USER, DB_PASSWORD, $t);
              unset($t);
          }
          catch(PDOException $ex) 
          { 
              $this-&gt;Error($ex-&gt;getMessage(), 'Connection', $ex-&gt;getFile(), $ex-&gt;getLine(), $ex-&gt;getTraceAsString());
          }
      }
  
      public function Run($QUERY, $PARAMS = array())
      {
  
          $this-&gt;Connect();
  
          try 
          {
              $sql = $this-&gt;db-&gt;prepare($QUERY);
  
              if (count($PARAMS) &gt; 0)
              {   
                  foreach ($PARAMS as $KEY=&gt;$VAL)
                  {
                      $sql-&gt;bindParam(str_replace(":", "", $KEY), $VAL);
                  }
              }
  
              $sql-&gt;execute();
              $this-&gt;SQLErrorInfo = $sql-&gt;errorInfo();
  
          }
          catch (Exception $ex)
          {
              $this-&gt;Error($ex-&gt;getMessage(), $QUERY, $ex-&gt;getFile(), $ex-&gt;getLine(), $ex-&gt;getTraceAsString());
              $this-&gt;SQLErrorCode = $sql-&gt;errorCode();
              $this-&gt;SQLErrorInfo = $sql-&gt;errorInfo();
              exit();
          }
          if (!$sql)
          {
              //fatal error
              $ex = $sql-&gt;errorInfo();
              $this-&gt;Error($ex[2], $QUERY, __FILE__, __LINE__, print_r(debug_backtrace(), true));
              exit();
          } 
  
          $this-&gt;last_insert_id = $this-&gt;db-&gt;lastInsertId();
          $this-&gt;affected_rows = $sql-&gt;rowCount();
  
          return $sql;//retval
      }
  
      public function addParam(&amp;$PARAMLIST, $PARCODE, $VAL)
      {
          $PARAMLIST[$PARCODE] = $VAL;
      }
  
      public function getQuery($QUERY, $PARAMLIST)
      {
          $retval = '/* params */' . "\n";
          if (count($PARAMLIST) &gt; 0)
          {
              foreach ($PARAMLIST as $key=&gt;$val)
              {
                  $newkey = str_replace(":", "", $key);
                  $retval .= 'SET @'. $newkey . ' = "' . $val . '";' . "\n";
                  $QUERY = str_replace($key, "@".$newkey, $QUERY);
              }
          }
          $retval .= "\n" . '/* Query */' . "\n" . $QUERY;
          return $retval;
      }
  </code></pre>
  
  <p>Result of getQuery call showing the variables are set</p>
  
  <pre><code>/* params */
  SET @P_Name = "test";
  SET @P_PartNumber = "test";
  SET @P_BarCodeNumber = "test";
  SET @P_LeadTimeWeeks = "1";
  SET @P_PriceGroup = "1";
  SET @P_MinOrderQty = "0";
  SET @P_ReorderPointOverride = "1";
  SET @P_MinimumStockLevelOverride = "0";
  SET @P_CurrentQuantity = "1";
  SET @P_ApplianceType = "2";
  SET @P_Rack = "";
  SET @P_Shelf = "";
  
  /* Query */
  INSERT INTO StockItemTypes SET  Name = @P_Name, PartNumber = @P_PartNumber, BarCodeNumber = @P_BarCodeNumber, LeadTimeWeeks = @P_LeadTimeWeeks,  PriceGroupFK = @P_PriceGroup, MinimumOrderQuantity = @P_MinOrderQty, ReorderPointOverride = @P_ReorderPointOverride,  MinimumStockLevelOverride = @P_MinimumStockLevelOverride, CurrentQuantity = @P_CurrentQuantity, ApplianceTypeFK = @P_ApplianceType,  Rack = @P_Rack, Shelf = @P_Shelf;
  </code></pre>
  
  <p>running the above inserts the data into the DB indicating the issue is somewhere in PDO.</p>