Execution multi prepared statement
Bonjour les amis,
Je rencontre un problème à l'exécution d'un scripte PHP qui contient plusieurs prepared statement et plusieurs execute qui font appelle à des procédure stockées.
voici le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| if (isset($_POST['autoCom']) && !empty($_POST['autoCom'])) {
$term = $_POST['autoCom'];
$connexion = pdo();
$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connexion->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
$stmt = $connexion->prepare("CALL get_club(?)");
$stmt->bindParam(1, $term);
$stmt->execute();
$tabElementDiv = array();
while ($rows = $stmt->fetchAll()) {
foreach ($rows as $row) {
array_push($tabElementDiv,$row);
}
}
array_push($tabElementDiv, "eq");
$stmt->closeCursor();
$stmt2 = $connexion->prepare("CALL get_eq(?)");
$stmt2->bindParam(1, $term);
$stmt2->execute();
while ($row = $stmt2->fetchAll()) {
foreach ($rows as $row) {
array_push($tabElementDiv,$row);
)
}
array_push($tabElementDiv, "cat");
$stmt2->closeCursor();
$stmt3 = $connexion->prepare("CALL get_cat(?)");
$stmt3->bindParam(1, $term);
$stmt3->execute();
while ($row = $stmt3->fetchAll()) {
foreach ($rows as $row) {
array_push($tabElementDiv,$row);
}
}
array_push($tabElementDiv, "fin");
$stmt3->closeCursor();
// affichage contenu
print_r($tabElementDiv);
//echo json_encode($tabElementDiv);
} |
J'ai également tester les différentes procédure stockées sur le terminal MYSQL et me renvoient les bons résultats.
Merci pour votre aide et votre temps.