lundi 23 novembre 2015

Else statement not working in PHP

I'm trying to get this code to work. Everything works fine except for the else statement:

if(!empty($_POST['user'])) 
{ 
    $query = mysql_query("SELECT * FROM users where username =  '$_POST[user]' AND password = '$_POST[pass]'") or die(mysql_error()); 
    $row = mysql_fetch_array($query) or die(mysql_error()); 


    if(($row['username'] == $_POST['user']) && ($row['password'] == $_POST['pass'])){

        echo = "Correct login";  
    }

    else {
        echo "Wrong Login"; // THIS STATEMENT WONT WORK!
    }
}
    else
    { 
        echo "Enter email and password";
     }

Please help!




Aucun commentaire:

Enregistrer un commentaire