CodeIgniter Forums
this simple imodel is returning false in my controller instead of true for password denis and username denis - 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: this simple imodel is returning false in my controller instead of true for password denis and username denis (/showthread.php?tid=60338)



this simple imodel is returning false in my controller instead of true for password denis and username denis - El Forum - 03-04-2014

[eluser]Unknown[/eluser]
This model is returning false from database and when i change the code so as to insert it is inserting data to database.Please help guys .I have no idea what the problem is

class Membership_model extends CI_Model{

function __construct(){

parent::__construct();
}
function validate(){

$this->db->where('user_name',$this->input->post('user_name'));
$this->db->where('password',md5($this->input->post('password')));
$query=$this->db->get('membership');

if($query->num_rows()==1){
return TRUE;
}


this simple imodel is returning false in my controller instead of true for password denis and username denis - El Forum - 03-04-2014

[eluser]InsiteFX[/eluser]
I would check to see what is being returned by your query, use var_dump or print_r to see what is returned.

From what you have shown theres not much to go on to help. Plus you should not use MD5 it has already been cracked.