Page 1 of 1

Error boolean code PHP

Posted: 19/09/2016 3:10 pm
by PhisonP
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\SQLPHP\config.php on line 23

this is my code
<?php

$dbHost = "localhost";
$dbUser = "root";
$dbPass = "MartAddmin";
$dbdatabase = "phpdb1";


$con = mysqli_connect($dbHost , $dbUser , $dbPass,$dbdatabase);

if(mysqli_connect_errno( ))
{
echo "Could not connect to database<br />";
echo mysqli_connect_error( );
}
else
{
echo "Succeasfully connected to database!<br />";
}

$result = mysqli_query($con ,"SELECT * FROM $dbdatabase");

while($row = mysqli_fetch_array($result))
{
echo $row["Student_ID"]." ".$row["Student_Name"]." ".$row["Student_Adress"]." ".$row["Student_Age"]."<br />";
}
echo "Finish while loop";
?>