Good day good people.I have unkown error while trying to display data from mysql to web using PHP.Error is:
mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\form_2\guestbook.php on line 17. Line 17 is like this:
while($row=mysqli_fetch_array($result))
I really don't know where the problem is, so i hope u will help me.Thank u all :D
Here is code i'am using Here is code that i am using.I just want to display data from database to web.
<?php
$con=mysqli_connect("localhost","root","","php_tests");
if (mysqli_connect_errno())
{
echo"Error connecting to database". mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM test_mysql");
while($row=mysqli_fetch_array($result))
{
$ime=$row['name'];
$prezime=$row['lastname'];
$id_number=$row['id'];
echo'<table border="1" width="33%">
<tr>
<td>Ime:</td>
<td>'.$ime.'</td>
</tr>
<tr>
<td>Prezime</td>
<td>'.$prezime.'</td>
</tr>
</table>
';
}
mysqli_close($con);
?>