词语“阵列”而不是行的值 [英] The word "Array" gets printed instead of the values of the rows
本文介绍了词语“阵列”而不是行的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,我是CI和MySQL的新手。这是我的代码:
Okay,i'm a newbie to CI and MySQL. This is my code:
<?php
class Trail2 extends CI_Controller{
public function boo() {
$this->load->database();
$this->load->helper('html');
$ret="SELECT * from posts";
$query=$this->db->query($ret);
foreach($query->result_array() as $row)
{
echo br(1);
echo $row;
}
}
}
?>
这将返回单词Array代替行的值。我不能明白为什么。提前致谢。 :)
and this returns the word "Array" in place of the values of the rows. I cant seem to figure out why though. Thanks in advance. :)
推荐答案
使用
var_dump($row);
而不是
echo $row;
如果你只是想看到数组的值, p>
and if you just want to see the values of the array you can do something like the following
for ($var = 0; $var < sizeof($row); $var++) echo $row[$var].", ";
这篇关于词语“阵列”而不是行的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文