title: Can't fetch any data with PDO's fetch or fetchAll function
body: <p>I've been at this for some time. Using PDO's documentation and based on older stackoverflow posts I feel I am doing this correct, however I can not figure out where my data is in the array returned by fetchAll. Any help would be appreciated.</p>
  
  <p>In my DatabaseHandler class:</p>
  
  <pre><code>public function getStateList(){
      $root = "root";
      $rootpasswd = "password";
      $host = "localhost";
      try{
          $dbh = new PDO("mysql:host=$host;dbname=TESTDATA;", $root, $rootpasswd);
          $stmt = $dbh-&gt;prepare("SELECT id FROM state");
          if(!$stmt-&gt;execute()){
              //error
          }
          $result = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
          return $result;
      }catch(PDOExeption $e){
          //catch exception
      }
  }
  </code></pre>
  
  <p>Now when calling this method it returns an array of 52 id's which is what it's supposed to do however I can not get to this data. Why? Here is the code that calls the method.</p>
  
  <pre><code>&lt;?php
      require("./Database/DatabaseHandler.php");
  
      $dbh = new DatabaseHandler();
      $stateCodes = $dbh-&gt;getStateList();
      $max = sizeof($stateCodes);
  
      error_log("Arraysize=".$max."\n", 3, "/testlog/data.dat");
      error_log("Position 0: ".$stateCodes[0]."\n", 3, "/testlog/data.dat");
      error_log("Position[0][0]: ".$stateCodes[0][0]."\n", 3, "/testlog/data.dat");
      error_log("Position[0][0][0]: ".$stateCodes[0][0][0]."\n", 3, "/testlog/data.dat");
  ?&gt;
  </code></pre>
  
  <p>The first errorlog records 52.
  The second returns the word Array which makes me think it's a 2 dim array.
  The Third nothing.
  The Fourth Nothing.</p>
  
  <p>I know I am using fetchAll wrong somehow but I can't figure out where or how. Thank you in advance.</p>