I install Xampp on Windows 7, and try to select data from a database table. For this I create code like this:
<?php
$con=mysqli_connect("localhost","test1","2jan1991","test1");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM Persons");
while($row = mysqli_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br>";
}
mysqli_close($con);
?>
But when I try to run code it has error like:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\t2\1.php on line 11
How to resolve this?