mysql> DELIMITER //
mysql> CREATE PROCEDURE test1()
-> BEGIN
-> SELECT * FROM user;
-> SELECT * FROM userAccount;
-> END
-> //
Query OK, 0 rows affected (0.03 sec)
mysql> DELIMITER ;
mysql>
<?php
try {
$pdo = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$sql = 'call test1()';
$stmt = $pdo->query($sql);
$rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
var_dump($rowset);
echo '<hr color="red">';
$stmt->nextRowset();
$rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
var_dump($rowset);
} catch (PDOException $e) {
echo $e->getMessage();
}
?>
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者