title: PDO_MYSQL: general error 2014
body: <p>I'm migrating from plain mysql_* to PDO (yeah, I know it's 2012 on the calendar).<br>
  I'm writing a simple wrapper class to have an opportunity to do things like
      $f=$db->FetchAll("SELECT * FROM...")
  on my website.
  Here's what I'm doing:  </p>
  
  <pre><code>    public function Query($q, $errmessage="", $params=array()) {
      try {
      $stmt=$this-&gt;connect-&gt;prepare($q);
      if (is_array($params) &amp;&amp; count($params)&gt;0) {
      $stmt-&gt;execute($params);
      } else {
      $stmt-&gt;execute();
      }
      return $stmt;
      } catch(PDOException $e) {
      die($errmessage.": ".$e-&gt;GetMessage());
      }
      }
  
     public function Fetch($q, $arraylist=0) {
      if (!is_object($q)) { // Assuming it's a raw query
      $stmt=$this-&gt;Query($q, "Unable to process the query for fetching");
      } else $result=$q;
      $f=$stmt-&gt;Fetch();
      return $f;
  }
  </code></pre>
  
  <p>And this throws a "general error 2014" exception.<br>
  Any help appreciated.<br>
  Thanks!</p>