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

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:
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" ;
    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

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

Theme © iAndrew 2016 - Forum software by © MyBB