循环 mysqli_result [英] Loop mysqli_result
本文介绍了循环 mysqli_result的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法弄清楚如何遍历此对象数组中的行.例如,我将如何回显每一行中的值?
$sql = "SELECT my_ids FROM manager WHERE is_live = 0";$result = $db->query($sql);
当我 print_r($result); 我得到 p><块引用>
mysqli_result 对象 ( [current_field] => 0 [field_count] => 1[长度] => [num_rows] => 15 [类型] => 0 )
解决方案
Try to loop on $result
with foreach
loop:
$val){echo "key is=> ".$key." and Value is=>".$val;}
键将是 current_field
field_count
等.
I can't seem to figure out how to loop through the rows in this object array. For example, how would I echo the value in each row?
$sql = "SELECT my_ids FROM manager WHERE is_live = 0";
$result = $db->query($sql);
When I print_r($result); I get
mysqli_result Object ( [current_field] => 0 [field_count] => 1 [lengths] => [num_rows] => 15 [type] => 0 )
解决方案
Try to loop on $result
with foreach
loop:
<?php
foreach($result as $key => $val)
{
echo "key is=> ".$key." and Value is=>".$val;
}
Keys will be current_field
field_count
etc.
这篇关于循环 mysqli_result的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文