While i am executing second Stored procedure with same connection statement(Using PDO), getting the below error.
=================================================
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.
=======================================================
This is my code in drupal
$conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$statement = $conn->prepare("CALL Odd_Get_Sport()");
$exec_result = $statement->execute();
while ($row = $statement->fetchObject()) {
print_r($row);
}
$statement ->closeCursor();
$statement1 = $conn->prepare("CALL Odd_Get_Sport()");
$exec_result1 = $statement1->execute();
while ($row1 = $statement1->fetchObject()) {
print_r($row1);
}
Help me on this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…