Welcome Guest, Not a member yet? Register   Sign In
How to get different user info when logged in.
#3

(01-23-2018, 04:54 AM)InsiteFX Wrote: It depends on what you are returning from your slug method an object or an associate array.

You need to show your get_by_slug method in your model.

I'm returning an object using $query->row(). Should I change it to result_array()?

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

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

 
       if ($query->num_rows() == 1) {
 
           return $query->row();
 
       } else {
 
           return false;
 
       }
 
   

But would it be possible to return value from a different table(users) ?
I do Front-End development most of the time 
Reply


Messages In This Thread
RE: How to get different user info when logged in. - by kirasiris - 01-23-2018, 12:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB