美文网首页
[PDO]①④--nextRowset()

[PDO]①④--nextRowset()

作者: 子木同 | 来源:发表于2017-09-04 16:57 被阅读14次
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();
}
?>
Paste_Image.png

相关文章

网友评论

      本文标题:[PDO]①④--nextRowset()

      本文链接:https://www.haomeiwen.com/subject/pcmejxtx.html