title: PDO returning null object when SQL query returning data
body: <p>When I query my long query to MYSQL directly I get right data </p>
  
  <p>But then I use PDO with same query I get no data (Object size zero) . Following data</p>
  
  <p><strong>SQL Statement :</strong> </p>
  
  <pre><code>SELECT table1.field1,table2.field1 FROM table1,table2 WHERE table1.key = table2.key AND table2.field2 ='coffee' AND (table2.date BETWEEN '2014-1-1' AND '2014-12-1');
  </code></pre>
  
  <p>I get desire output when i directly run the query on mysql.</p>
  
  <p>However, when I run using php file having following content I get nothing </p>
  
  <pre><code>include 'config.php';
  $query = 'SELECT table1.field1,table2.field1 FROM table1,table2 WHERE table1.key = table2.key AND table2.field2 ='coffee' AND (table2.date BETWEEN '2014-1-1' AND '2014-12-1')';
  $stmt = $db-&gt;query($query)-&gt;fetchAll();
  var_dump($stmt);
  </code></pre>
  
  <p>output is </p>
  
  <pre><code>array(0) { } 
  </code></pre>
  
  <p>I also tried </p>
  
  <pre><code>$query = "SELECT table1.field1,table2.field1 FROM table1,table2 WHERE table1.key = table2.key AND table2.field2 ='coffee' AND (table2.date BETWEEN '2014-1-1' AND '2014-12-1')";
  </code></pre>
  
  <p>and </p>
  
  <pre><code>  $query =  ' SELECT table1.field1,table2.field1 FROM table1,table2 WHERE table1.key = table2.key AND table2.field2 = \'coffee\'  AND (table2.date BETWEEN  \'2014-1-1\'  AND  \'2014-12-1\' )' ;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$query =  ' SELECT table1.field1,table2.field1 FROM table1,table2 WHERE table1.key = table2.key AND table2.field2 = \'coffee\'  AND  \( table2.date BETWEEN  \'2014-1-1\'  AND  \'2014-12-1\'\)' ;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$query =  " SELECT table1.field1,table2.field1 FROM table1,table2 WHERE table1.key = table2.key AND table2.field2 = \'coffee\'  AND  \( table2.date BETWEEN  \'2014-1-1\'  AND  \'2014-12-1\'\)" ;
  </code></pre>
  
  <p>What am I doing wrong?</p>