Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

User ID data not showing.

$
0
0
Hello everybody,


Can somebody tell me where I got the error in my code? I already tried different queries in my get_userdata method and I even tried $query->result_objec(); but so far I've been unable to display the correct info.


This is my user method in User_controller:

PHP Code:
    public function user($id){
 
       //Check Login
 
       if (!$this->session->userdata('is_member')) {
 
           redirect('dashboard/login');
 
       
        
} else {
        
        
// Get user info
 
       $data['item'] = $this->User_model->get_userdata($id);
            
 
       // Load template
 
       $this->template->load('public''default''users/user'$data);
        
        }
    } 

This is my get_userdata method in my User_model:

PHP Code:
   public function get_userdata($id)
 
   {
 
       $this->db->select('*');
 
       $this->db->from($this->table);
 
       $this->db->where('id'$id);
 
       $this->db->limit(1);

 
       $query $this->db->get();

 
       if ($query->num_rows() > 1) {
 
           return $query->row(); //using row as I'm usng $item->username ,etc as well
 
       } else {
 
           return false;
 
       }
 
   

and this is my view in which I need to display the user data according to the user ID:

PHP Code:
<section class="showcase text-center" style="background: url(<?php if($item->cover_img) : echo $item->cover_img; else : echo base_url().'assets/img/nocoverimage.gif'; endif ?>)no-repeat center center; background-attachment:fixed;">
    <
div class="container">
    <
img class="img-thumbnail" src="<?php if($item->avatar_img) : echo $item->avatar_img; else : echo base_url().'assets/img/noavatar.jpg'; endif ?>">
 
       <h1><?php echo get_user_full_name($item->user_id); ?></h1>
        <p><?php echo $item->occupation ?></p>
        <a href="#" class="btn btn-outline btn-lg">Follow</a>
    </div>
</section> 

Viewing all articles
Browse latest Browse all 14114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>