How to fix Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in D:\wamp64\www\liveSearch\livesearch.php on line 12
hello I have the same issue with my code and here is my code please help !
<?php
include("config.php");
if(isset($_POST['input'])){
$input = $_POST['input'];
$query = "SELECT * FROM wheat_genes WHERE Gene_Name LIKE '{$input}%' OR Gene_id LIKE '{$input}%' OR Gene_Annotation '{$input}%' OR Gene_Regulation LIKE '{$input}%'";
$result = mysqli_query($con, $query);
if(mysqli_num_rows($result)>0){?>
<table class="table table-bordered table-striped mt-4">
<thead>
<tr>
<th>ID</th>
<th>Gene_id</th>
<th>Gene_Name</th>
<th>Gene_Annotation</th>
<th>Gene_Regulation</th>
<th>CDS</th>
<th>Primer_R</th>
<th>Primer_F</th>
<th>CG%</th>
<th>Compelet_seqence</th>
</tr>
</thead>
<tbody>
<?php
while($row=mysqli_fetch_assoc($result)){
$id = $row["ID"];
$Gene_id= $row["Gene_id"];
$Gene_Name = $row["Gene_Name"];
$Gene_Annotation = $row["Gene_Annotation"];
$Gene_Regulation = $row["Gene_Regulation"];
$CDS = $row["CDS"];
$Primer_R = $row["Primer_R"];
$Primer_F = $row["Primer_F"];
$CG = $row["CG%"];
$Compelet_seqence = $row["Compelet_seqence"];
}
?>
<tr>
<td><?php echo $ID ;?></td>
<td><?php echo $Gene_id ;?></td>
<td><?php echo $Gene_Name ;?></td>
<td><?php echo $Gene_Annotation ;?></td>
<td><?php echo $Gene_Regulation ;?></td>
<td><?php echo $CDS ;?></td>
<td><?php echo $Primer_R ;?></td>
<td><?php echo $Primer_F ;?></td>
<td><?php echo $CG ;?></td>
<td><?php echo $Compelet_seqence ;?></td>
</tr>
</tbody>
</table>
<?php
}else{
echo "<h4 class='text-danger text-center mt-3'>No data Found</h4>";
}
};
?>