I am writing a code which compares the user passwords using password verify and outputting the result accordingly. Also, I'm printing a hashed password from database before comparing. But, I am getting the error Fatal error: Call to a member function fetch_assoc() on boolean Here is the DbConnect.php file included in main file
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "task_manager";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
 die("Connection failed: " . $conn->connect_error);
} 
?>
Here is the main file with an error
<?php
include "DbConnect.php";
 $email = "joshiashish191@gmail.com";
 $user_password = "123456";
 $sql = "SELECT password from users WHERE email = $email";
 $result = $conn->query($sql);
    while($row = $result->fetch_assoc()) {
    echo $row["password"];
    }
 if(password_verify($user_password, $result)){
     echo "password matches!";
 }
 else
     echo "Passwords do not match.";
?>
Whats wrong with this can anyone tell please?
 
    