title: PDO SHOW TABLES array
body: <p>Just working with this function and it's not working out as planned. It is supposed to grab all table names in a database and store them in an array. However the results of the array is doubling up the array shown in the example below:</p>
  
  <pre><code>Array ( [0] =&gt; 113340 ) 
  Array ( [0] =&gt; 113340 [1] =&gt; 116516 ) 
  Array ( [0] =&gt; 113340 [1] =&gt; 116516 [2] =&gt; 139431 ) 
  Array ( [0] =&gt; 113340 [1] =&gt; 116516 [2] =&gt; 139431 [3] =&gt; 20731 ) 
  Array ( [0] =&gt; 113340 [1] =&gt; 116516 [2] =&gt; 139431 [3] =&gt; 20731 ... )
  </code></pre>
  
  <p>The code that I am using:</p>
  
  <pre><code>function itemDiscontinued($dbh, $id, $detail) {
    try {
      $tableList = array();
      $result = $dbh-&gt;query("SHOW TABLES");
      while ($row = $result-&gt;fetch(PDO::FETCH_NUM)) {
        $tableList[] = $row[0];
        print_r($tableList);
      }
    }
    catch (PDOException $e) {
      echo $e-&gt;getMessage();
    }
  }
  </code></pre>