简体   繁体   中英

error getting the array result in Join Query in Codeigniter

Hello this is my query and I have the problem getting the 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

<?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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM