Jump to content

Trouble With Select PHP and MySQL


Cooley
 Share

Recommended Posts

Hi,

I have trouble with the following code, the login_success always returns false 

Quote

require_once('database_credentials.php');
  $conn = new mysqli($db_servername,$db_username,$db_password,$db_name);

$login_success = false;

if(isset($_POST['email']) && isset($_POST['password'])){


                    if($conn->connect_error){
    
                            die ("Connection failed : ".$conn->connect_error);
    
    
                    }else {


                        $sql = "SELECT * FROM users WHERE email_address = ' ".$_POST['email']." ' AND password = '".$_POST['password']."' ";
                        $result = $conn->query($sql);
                        
                        if($result){
                            
                            $login_success = true;
                        
                            
                        }else{
                            
                            $login_success = false;
                            echo 'error '.mysqli_error($conn);
                            
                        }

                    }

}

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...