$q = intval($_GET['q']);
$con = mysqli_connect('localhost','root','','my_db');
if (mysqli_connect_errno()) {
echo "Fail to connect :".mysqli_connect_error();
}
mysqli_select_db($con,"my_db");
$sql="SELECT * FROM ajax WHERE id = '".$q."'";
$result = mysqli_query($con,$sql);
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row('Firstname') . "</td>";
echo "<td>" . $row('Lastname') . "</td>";
echo "<td>" . $row('AGE') . "</td>";
echo "<td>" . $row('Hometown') . "</td>";
echo "<td>" . $row('Job') . "</td>";
echo "</tr>";
echo "</table>";
}
mysqli_close($con);
I keep getting this error :Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\abc\getuser.php on line 22
I apologize in advance if there is already an answer to this simple problem, I am new at coding and I have spent quite some time reading other similar questions but still couldn't solve this problem. Thx in advance.