5
I am creating a registration page where I have several tabs, as the structure below:
<div> Aba 1 </div>
<div> Aba 2 </div>
<div> Aba 3 </div>
<div> Aba 4 </div> e assim vai...
Within each tab I have an sql query using PDO, only when I arrive at the tab 4 appears the following error message:
Array ( [0] => 00000 [1] => 2014 [2] => 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. )
I already activated and deactivated the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY but nothing solves...
* My Consultation *
<tbody>
<?php
$sql5 = "CALL sp_FornecedorAnalitico_Selecionar(:codigoFornecedor, :tipo)";
$stmt5 = $conexao_oo->conn->prepare($sql5);
$stmt5->bindValue(":codigoFornecedor", $_GET['codForn']);
$stmt5->bindValue(":tipo", 5);
$stmt5->execute();
$dadosFornecedor5 = $stmt5->fetchAll(PDO::FETCH_OBJ);
print_r($stmt5->errorInfo());
foreach ($dadosFornecedor5 as $pedido) {
echo "<tr>";
echo "<td>".$pedido->codSol."</td>";
echo "<td>".$pedido->numPedido."</td>";
echo "<td>".$pedido->solicitante."</td>";
echo "<td>".$pedido->empresa."</td>";
echo "<td>".$pedido->setor."</td>";
echo "<td>".$pedido->tipo."</td>";
echo "<td>".$pedido->prevEntrega."</td>";
echo "<td></td>";
echo "<td>".$pedido->condicao."</td>";
echo "<td>".$pedido->status_sc."</td>";
echo "<td>".$pedido->valor_total."</td>";
echo "<td><a target='_blank' title='Visualizar Itens da Solicitação' href='visualizar_sc.php?cod_solicitacao=".$valor->codScompra."'><img src='images/icons/search.png'></a></td>";
echo "</tr>";
}
?>
</tbody>
Could put part of the source code.
– rray
place the part where you request PDO not only html please
– Luciano Azevedo
I edited the question...I put there how I am doing the PDO request
– Tafarel_Brayan
Before this code has four more queries? , this reply from Soen suggests that you each 'query' after the
execute()
thus:$stmt5->closeCursor();
– rray
@rray Valew... it worked !!
– Tafarel_Brayan
The
closeCursor()
you called after theexecute()
or offetchAll()
?– rray
after fetch(), there is a difference ????
– Tafarel_Brayan
I tested after execute() and did not come the query result, only returned the lines when I called after fetch/fetchAll, in my test I did not use stored Procedure.
– rray