title: how to resolve General error: 2014 Cannot execute queries while other unbuffered queries are active. using PDO connection
body: <p>While i am executing second Stored procedure with same connection statement(Using PDO), getting the below error.</p>
  
  <p>=================================================</p>
  
  <p>SQLSTATE[HY000]: 
  General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll().
   Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the 
  PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.</p>
  
  <p>=======================================================</p>
  
  <p>This is my code in drupal</p>
  
  <pre><code>$conn-&gt;setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
  
  $statement = $conn-&gt;prepare("CALL Odd_Get_Sport()");
  $exec_result = $statement-&gt;execute();
  while ($row = $statement-&gt;fetchObject()) {   
    print_r($row);
  }
  
  
  $statement -&gt;closeCursor();
  
  $statement1 = $conn-&gt;prepare("CALL Odd_Get_Sport()");
  $exec_result1 = $statement1-&gt;execute();
  while ($row1 = $statement1-&gt;fetchObject()) {   
     print_r($row1);
  }
  </code></pre>
  
  <p>Help me on this.</p>