![]() |
Undefined property problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Undefined property problem (/showthread.php?tid=14626) |
Undefined property problem - El Forum - 01-09-2009 [eluser]tim1965[/eluser] Hi i am trying to store some data in a session and then retrieve it in a controller. I am using dx_auth which has an event that is calles on ligin. so i use the event to add to the session info function user_logged_in($user_id) { //run dx_auth function to get username $uname = $this->ci->dx_auth->get_username('username'); //query my table to get propery_id using username $this->ci->db->where('username',$uname); $this->ci->db->select('property_id'); $query = $this->ci->db->get('master_property_reference'); $row = $query->row(); //add to ci_session database for use in each page $add_prop_id = array( 'propertyid' => $row->query ); $this->ci->session->set_userdata($add_prop_id); redirect('c_propman_v1'); } I then call a controller to echo the info class C_propman_v1 extends Controller { function index() { parent::controller(); $this->load->helper(array('form', 'url')); $this->load->library('DX_Auth'); $this->load->library('DX_Auth_event'); $this->load->library('session'); $query = $this->ci->session->userdata($add_prop_id); return $query->result(); echo $query; } } but i keep on bombing out on $query = $this->ci->session->userdata($add_prop_id); with undefined property and Message: Trying to get property of non-object and Fatal error: Call to a member function userdata() on a non-object in C:\wamp\www\ci\system\application\controllers\c_propman_v1.php on line 13 any help would be appreciated as i am pulling my hair out on this. Thanks Undefined property problem - El Forum - 01-09-2009 [eluser]tim1965[/eluser] Im declaring today to be "Hug a newbie and help them out with their code" day. I would really like to crack this problem today. |