查询结果当然是放入数组或者对象了.
如果不是手动释放资源就等脚本执行结束.
<?php
$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);
?>
下面处理$result就行了.数据库关闭是否和他就没关系了.也就是说在获值后就可以关闭数据库连接了
如果不是手动释放资源就等脚本执行结束.
<?php
$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);
?>
下面处理$result就行了.数据库关闭是否和他就没关系了.也就是说在获值后就可以关闭数据库连接了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货