<?php
include "config.php";
$q=$_GET['q'];

$r=mysqli_query($conn,"
SELECT * FROM patients
WHERE name LIKE '%$q%' OR mobile LIKE '%$q%'
");

echo "<table border='1'>";
while($row=mysqli_fetch_assoc($r)){
echo "<tr>
<td>{$row['name']}</td>
<td>{$row['mobile']}</td>
<td><a href='prescription.php?pid={$row['id']}'>Prescription</a></td>
</tr>";
}
echo "</table>";
?>
