Welcome Guest, Not a member yet? Register   Sign In
condition check failure
#1

[eluser]agubski[/eluser]
after a cup of coffee the same code just stopped messing around. Must be miracle Smile

Hi there,

I have a simple if - then condition which fails and I can't see what the problem is. here is the code:
Code:
function displayuser()
    {

    $query = $this->db->get_where('users', array('user-email' =>$_POST['e-mail']));
                
    if ($query->num_rows() == 0) {    
            
         echo "user doesn't exist" ;
            
            
    } elseif ($query->row()->password == $_POST['password']){
        
      echo "All is good" ;
            
    }else{
        
    echo "password doesn't match for this user";
            
    }    
                    
}

PHP error I see is - Trying to get property of non-object in "elseif" line

I think the elseif check shouldn't go ahead if the first condition is met. However it seems like the code is trying to run this line anyways and obviously there is no variable to test...

Appreciate your ideas
#2

[eluser]Colin Williams[/eluser]
Are you sure you're running PHP 5?




Theme © iAndrew 2016 - Forum software by © MyBB