title: Call to undefined method PDO::fetch()
body: <p>I know there are few other questions on here with this title, but they seem to be case specific or I just can't wrap my head around it but I'm getting that error on this code, and I can't figure out why. </p>
  
  <pre><code>$db = new PDO($dsn, $username, $password);
  $query = "Select * FROM book INNER JOIN course
            ON book.course = course.courseID
            ORDER BY courseTitle";
  
  //query result
  $books = array();
  $sth = $db-&gt;query($query);
  while( $row = $db-&gt;fetch(PDO::FETCH_ASSOC) ) {
      $books[] = $row; // appends each row to the array
  }
  </code></pre>
  
  <p>I thought maybe my query was wrong, so I tried an example from a <strong><code>PDO</code></strong> tutorial, and I got the same type of error. Is there something I have to declare or am I leaving something out?</p>