having issues with Error: Trying to get Property of Non Object. Help!!! - 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: having issues with Error: Trying to get Property of Non Object. Help!!! (/showthread.php?tid=52126) |
having issues with Error: Trying to get Property of Non Object. Help!!! - El Forum - 05-30-2012 [eluser]reghan[/eluser] Hello I am getting the error trying to get property of non object. here is my code Model: Code: <?php Code: function get_dept_info() Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> I basically am just looking to print out the department name based on the id selected. I feel like this should be simple and am not really sure where I am going wrong. Thanks to all who reply!! having issues with Error: Trying to get Property of Non Object. Help!!! - El Forum - 05-30-2012 [eluser]mudshark[/eluser] Are you loading the Department_model in your controller's constructor? Also, your table is either "Department" or "department" - you have both in your model. having issues with Error: Trying to get Property of Non Object. Help!!! - El Forum - 05-30-2012 [eluser]weboap[/eluser] i think your issue is you are using ->result() instead of ->row() another way to do things. Code: //in model in controller Code: $data['department'] = $this->department_model->get_by_id($id); in view Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |