NEED HELP SQL DATABASE PHP FORM!!!!
Can somebody tell me whats wrong with this code. I defined this file as database_connection.php <?php $connection = mysqli_connect("localhost", "root", "", "loginpage"); if(!$connection) { echo "Something went wrong please try again later"; } ?> I defined this one as form.php <?php include "database_connection.php"; $username = $_POST["username"]; $password = $_POST["password"]; $sql = "INSERT INTO users (username, password) VALUES('$username', '$password')"; if(!$sql) { echo "There was an error creating your account"; } if($sql) { header("Location: login.html"); } ?> I defined this one as login.php <?php include "database_connection.php"; $username = $_POST["username"]; $password = $_POST["password"]; $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $result = $connection->query($sql); if(!$row = $result->fetch_assoc()) { echo "Your username or password is incorrect?"; } else { echo "Welcome back"; } ?> so I signup making the username Jerome and the password Jerome then I go to login and I put the username as Jerome and the password as Jerome but it always returns "Your username or password is incorrect" I don't know what I did wrong. Somebody help pleaase