I am having an error in php search. If the record is not found it echo "Record Not Found". But if the record is found it is still giving same message "Record Not Found"
<?php
if(isset($_GET['submit']))
{
$search = $_GET["search"];
$result = mysqli_query($conn, "select * from login where password like
'".$_GET['search']."%' or email like '".$search."%' ");
$rows = 0;
while($rows = mysqli_fetch_array($result))
{
?>
<tr>
<td>
<?php echo $rows['email']; ?>
</td>
<td>
<?php echo $rows['password']; ?>
</td>
<td>
<a href="edit.php?id= <?php echo $rows['id']; ?> ">Edit</a> ,<a
href="assets/php/del.php?id= <?php echo $rows['id']; ?>">Del</a>
</td>
</tr>
<?php
$rows++;
}
if($rows == 0)
{
echo "No Record Found";
}
}
?>