require_once "require.php";
$con = new mysqli($hn,$un,$pas,$db);
if ($con->connect_error)
{
die("Unbale to connect to the Server");
}
if (isset($_POST["login"]))
{
$uname = $_POST["uname"];
$lpass = $_POST["lpass"];
$query = "SELECT PASSWORD FROM users WHERE username='$uname'";
$result = $con->query($query);
$dpass = $result->fetch_assoc()['password'];
if ($dpass==$lpass)
{
echo "Passwords Match";
}
}
I'm trying to match the password that the user has entered and the one in the database, I don't know if the way i have used is the right way of getting the password, any help would be appreciated.