New to Codeigniter Error issue with Login and Register code - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: New to Codeigniter Error issue with Login and Register code (/showthread.php?tid=64777) |
New to Codeigniter Error issue with Login and Register code - ossieboy - 03-25-2016 Hi Very new to Codeigniter when using the Login and Register Video part 6 I keep coming up with this error, when xss_clean is taken out of the code as advised. A PHP Error was encountered Severity: Notice Message: Undefined property: Main::$db Filename: core/Model.php Line Number: 77 Backtrace: File: C:\wamp\www\ci_user\application\models\model_users.php Line: 7 Function: __get File: C:\wamp\www\ci_user\application\controllers\main.php Line: 37 Function: can_log_in File: C:\wamp\www\ci_user\application\controllers\main.php Line: 27 Function: run File: C:\wamp\www\ci_user\index.php Line: 292 Function: require_once Fatal error: Call to a member function where() on a non-object in C:\wamp\www\ci_user\application\models\model_users.php on line 7 A PHP Error was encountered Severity: Error Message: Call to a member function where() on a non-object Filename: models/model_users.php Line Number: 7 Backtrace: Any help would be appreciated RE: New to Codeigniter Error issue with Login and Register code - pravins - 03-25-2016 Can you please post the code RE: New to Codeigniter Error issue with Login and Register code - Rhyno_xD - 03-25-2016 did you extend CI_Model class also post the code here. RE: New to Codeigniter Error issue with Login and Register code - ossieboy - 03-25-2016 (03-25-2016, 09:45 AM)Rhyno_xD Wrote: did you extend CI_Model class also post the code here. class model_users extends CI_Model{ public function __construct() parent::__construct(); $this->load->database(); public function can_log_in(){ $this->db->where('email',$this->input->post('email')); $this->db->where('password',md5($this->input->post('password'))); $query = $this->db->get('user'); if ($query->num_rows()== 1){ return true; }else{ return false; } } } RE: New to Codeigniter Error issue with Login and Register code - ossieboy - 03-28-2016 (03-25-2016, 11:00 AM)ossieboy Wrote:(03-25-2016, 09:45 AM)Rhyno_xD Wrote: did you extend CI_Model class also post the code here. RE: New to Codeigniter Error issue with Login and Register code - ciadmin - 03-29-2016 It sounds like your database driver is not being loaded ... $this->load->library('database'); or autoload it. Further, your class name may work on WIndows, but you will have issues with the non-UCfirst name if you deploy to a Linux server; the class name should be Model_users. RE: New to Codeigniter Error issue with Login and Register code - ossieboy - 03-29-2016 (03-29-2016, 12:29 AM)ciadmin Wrote: It sounds like your database driver is not being loaded ... $this->load->library('database'); or autoload it. Thanks for your help the problem was in $autoload['libraries'] = array('database', 'email', 'session'); the array was not loaded with information. Now working fine thanks I bet us newbies keep you busy with crazy questions?? |