簡體   English   中英

在Codeigniter中的Join Query中獲取數組結果時出錯

[英]error getting the array result in Join Query in Codeigniter

您好,這是我的查詢,我在獲取result_array()時遇到問題。

這是錯誤:

致命錯誤:在第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 ?>

嘗試這個:

 $post = $this->db->get()->result_array();  
 foreach($post as $row): //etc

嘗試這個 :

$post->result() as $row

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM