I have written code to search data. But when I am running code it's not showing any error and not fetching any data. Could anyone please help me to find out the problem?
HERE IS MY CODE
<?php
$db = new PDO('mysql:dbname=mypro_bms;host=localhost', 'root', '');
$people = [];
if (!empty($_GET['p'])) {
$count='count';
$sum='sum';
$stmt=$db->prepare("SELECT passport_IC,count(*) as count,sum(blood_bag) as sum FROM donate GROUP BY passport_IC where passport_IC like :passport_IC");
$stmt->execute([
':passport_IC' => '%' . $_GET['p'] .'%',
':count'=> $count,
':sum' => $sum,
]);
$people = $stmt->fetchAll(PDO::FETCH_OBJ);
}
?>
<table class="table table-bordered">
<tr>
<th><center> passport </center></th>
<th><center> Donation Completed</center></th>
<th>blood donated</th>
<th><center> Percentage</center></th>
</tr>
<?php foreach($people as $donors): ?>
<tr>
<td><center><b><font color="black"><?= $donors->passport_IC; ?></font></b></center></td>
<td><center><b><font color="black"><?= $donors->count; ?>*Times*</font></b></center></td>
<td><center><b><font color="black"><?= $donors->sum; ?>ml</font></b></center></td>
</tr>
<?php endforeach; ?>
</table>