I have a database which have 4 records in it. And I want to display the record details of which having reg_no = "IT17052498" (I'm already having that record in the db). But it gives and error like
"Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\labsheet 10\addcomment.php on line 85"
Database connection are as followed name(db_connect.php)
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$mysql_db = "iwt";
$connection = mysqli_connect($hostname,$username,$password,$mysql_db);
if(!$connection)
{
die("Error : ".mysqli_error($connection));
}
else
{
echo "Successfully Connected!<br>";
}
?>
Here is my php code..
<html>
<body>
<table border="1">
<tr>
<th>Registration Number</th>
<th>Student Name</th>
<th>Comment on ITA</th>
</tr>
<?php
if(isset($_POST["btn_search"]))
$srch = $_POST["search"];
$query = "SELECT * FROM library_comment WHERE regNo = $srch";
$exst = mysqli_query($connection,$query);
while($row = mysqli_fetch_array($exst))
{
?>
<tr>
<td><?php echo $row['regNo'] ?></td>
<td><?php echo $row['name'] ?></td>
<td><?php echo $row['comment'] ?></td>
</tr>
<?php
}
?>
</table>
</body>