I have created a PHP & MySql login but its not working. If I put the right email/password still its showing "Wrong Username or Password" everytime. Bacause I'm beginner to this I don't really know how to solve this issue. Thanks in advance.
Here is my coding
<?php
// Start PHP session at the beginning
session_start();
// Create database connection using config file
include_once("connection.php");
// If form submitted, collect email and password from form
if (isset($_POST['login'])) {
$email = $_POST['email'];
$password = $_POST['password'];
// Check if a user exists with given username & password
$result = mysqli_query($conn, "select 'Email', 'Password' from tblstudent
where Email='$email' and Password='$password'");
// Count the number of user/rows returned by query
$user_matched = mysqli_num_rows($result);
// Check If user matched/exist, store user email in session and redirect to sample page-1
if ($user_matched > 0) {
$_SESSION["email"] = $email;
header("location: welcome.php");
} else {
echo "User email or password is not matched <br/><br/>";
}
}
?>