泰兴中等专业学校,刘丹车祸现场尸体,爱彩网主页
对于php的缓冲模式查询大家都知道,下面列举的例子是如何执行非缓冲查询api。
非缓冲查询方法一: mysqli
<?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); $uresult = $mysqli->query("select name from city", mysqli_use_result); if ($uresult) { while ($row = $uresult->fetch_assoc()) { echo $row['name'] . php_eol; } } $uresult->close(); ?>
非缓冲查询方法二: pdo_mysql
<?php $pdo = new pdo("mysql:host=localhost;dbname=world", 'my_user', 'my_pass'); $pdo->setattribute(pdo::mysql_attr_use_buffered_query, false); $uresult = $pdo->query("select name from city"); if ($uresult) { while ($row = $uresult->fetch(pdo::fetch_assoc)) { echo $row['name'] . php_eol; } } ?>
非缓冲查询方法三: mysql
<?php $conn = mysql_connect("localhost", "my_user", "my_pass"); $db = mysql_select_db("world"); $uresult = mysql_unbuffered_query("select name from city"); if ($uresult) { while ($row = mysql_fetch_assoc($uresult)) { echo $row['name'] . php_eol; } } ?>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
YII2框架中使用RBAC对模块,控制器,方法的权限控制及规则的使用示例
YII2框架中ActiveDataProvider与GridView的配合使用操作示例
PhpStorm的使用教程(本地运行PHP+远程开发+快捷键)
网友评论