Message: Call to a member function row() on boolean |
Hey guys, took me the entire week to get familiarise with your CI FrameWork. However been having an issue with fetching and inserting data into the sqli database... I checked the Database connectivity config file and it seems fine.
anyways this is my issue below: ---------------------------------------------------------------------------------------- An uncaught Exception was encountered Type: Error Message: Call to a member function row() on boolean Filename: /application/models/Login_model.php -------------------------------------------------------------------------------------- and this is my code: <?php class login_model extends CI_Model { function cek_login($where) { $this->db->order_by('user_name', 'DESC'); print_r($this->db->get_where('admin', $where)->row()); $query=$this->db->get_where('admin', $where)->row_array(); $data = array(); if($query !== FALSE && $query->num_rows() > 0){ foreach ($query->result_array() as $row) { $data[] = $row->row_array(); } } return $data; } } ---------------------------------------------------------------------------------------------------- anywayz hope someone out there with enough experience is able to really help me solve this.
Just for clarity,
1. Your class name should be the same with the file name. Code: class Login_model 2. Why are you "printing" the row() Code: row()
(11-23-2020, 05:15 AM)gelson Wrote: Hey guys, took me the entire week to get familiarise with your CI FrameWork. ...and you decided to learn CI 3 instead of CI 4? Anyway, maybe look at this tutorial in the user guide: http://codeigniter.com/userguide3/tutori...ction.html PHP Code: $query = $this->db->get_where('news', array('slug' => $slug));
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |