Model code for handle login in Codeigniter

class Loginmodel extends CI_Model{
	
	public function login_valid( $email, $password )
	{
		$q = $this->db->where(['email' => $email, 'password' => $password])
					  ->get('users');
		
		if( $q->num_rows() )
		{
			//return $q->row()->id;
			return $q->row();
			
		}
		else
		{
			return FALSE;
		}
	}
	
}

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>