PDO遍历

pdo除了用while和foreach遍历之外。有没有什么其他函数直接将遍历出来的东西遍历出来呢?
像$a=while(){}
$a=foreach(){}
是不能的。
我想用一个变量来装遍历出来的东西。

作者: icokescow   发布时间: 2011-05-31

你也可以用for循环来遍历。

作者: jordan102   发布时间: 2011-05-31

手册中的例子
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();

/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);

作者: xuzuning   发布时间: 2011-05-31