Question: I need solution: Warning : mysqli_fetch_array() expects parameter1 to be mysqli_result, boolean given in C:xampphtdocsWeb0login.php on line 86 the code:

I need solution:

Warning: mysqli_fetch_array() expects parameter1 to be mysqli_result, boolean given inC:xampphtdocsWeb0login.php on line86

the code:

//server information
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "project";

//connect to the database
$conn = new mysqli($servername, $username,$password, $dbname);
// check the connection
if ($conn->connect_error) {
die("Connection failed:" . $conn->connect_error);
}

$username = $_POST['username'];
$password = $_POST['password'];
$type = $_POST['type'];

//
$sql = "SELECT * FROM users,seller,adminnWHERE username = '$username' AND password = '$password'";
$result=mysqli_query($conn,$sql);
$row=mysqli_fetch_array($result,MYSQLI_ASSOC);

if($row['username']==$username &&$row['password']==$password){

switch($row['type']){
case 'Sdmin':
header("location: admin/Admin.php");
break;
case 'Seller':
header("location: seller/sellerpage.php");
break;
}
}else {
echo"

Sorry, the username or password areincorrect!


";
echo "

Try Again

";

}
?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!