[英]error getting the array result in Join Query in Codeigniter
Hello this is my query and I have the problem getting the result_array(). 您好,这是我的查询,我在获取result_array()时遇到问题。
This is the error: 这是错误:
Fatal error: Call to a member function result_array() on a non-object in C:\\xampp\\htdocs\\plss\\application\\views\\Admin\\post_refresh.php on line 6 致命错误:在第6行的C:\\ xampp \\ htdocs \\ plss \\ application \\ views \\ Admin \\ post_refresh.php中的非对象上调用成员函数result_array()
<?php
$this->db->select('*');
$this->db->from('forum_thread');
$this->db->join('useraccount','useraccount.user_id = forum_thread.user_id');
$post= $this->db->get();
foreach($post->result_array() as $row): ?>
<div class="panel panel-default" >
<div class="panel-body">
<p>
<small>Clinton Puds</small>
<small style="float:right;color:#808080;font-size:10px;"><b>Posted Last</b> <?php echo $row['date_last_post']?></small>
</p>
<p><?php echo $row['slug'];?></p>
</div>
<div class="panel-footer"><small><a href="">Comment</a></small></div>
</div>
<?php endforeach ?>
Try this: 尝试这个:
$post = $this->db->get()->result_array();
foreach($post as $row): //etc
尝试这个 :
$post->result() as $row
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.