您好,这是我的查询,我在获取 result_array() 时遇到问题。
这是错误:
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
<?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 ?>
最佳答案
试试这个:
$post = $this->db->get()->result_array();
foreach($post as $row): //etc
关于php - 在 Codeigniter 的连接查询中获取数组结果时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25846578/