mysqli_fetch_object(result,classname,params);
它以对象的形式返回输出集的当前行。
Sr.No | 参数 & Description |
---|---|
1 |
result 它指定mysqli_query()、mysqli_store_result()或mysqli_use_result()返回的输出集标识符 |
2 |
classname 它指定要实例化的类的名称 |
3 |
params 它指定要传递给classname对象的构造函数的参数组 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-mysqli-fetch-object.html 来源:LearnFk无涯教程网 |
它返回所提取行的字符串属性,如果输出集中没有更多的行,则返回NULL
<?php $connection_mysql=mysqli_connect("localhost","user","password","db"); if (mysqli_connect_errno($connection_mysql)){ echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $sql="SELECT name FROM emp"; if ($result=mysqli_query($connection_mysql,$sql)){ while ($obj=mysqli_fetch_object($result)){ print $obj->name; print "\n"; } mysqli_free_result($result); } mysqli_close($connection_mysql); ?>
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)