看一下
PDOStatement.fetchAll方法。您也可以
fetch在迭代器模式中使用。
fetchAll来自PHP文档的的代码示例:
<?php$sth = $dbh->prepare("SELECt name, colour FROM fruit");$sth->execute();print("Fetch all of the remaining rows in the result set:n");$result = $sth->fetchAll(PDO::FETCH_ASSOC);print_r($result);
结果:
Array( [0] => Array ( [NAME] => pear [COLOUR] => green ) [1] => Array ( [NAME] => watermelon [COLOUR] => pink ))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)