I have this code
<?php
include("db.php");
$sql="select * from lead";
$result=mysqli_query($conn, $sql);
$i=0;
?>
<?php while($row=mysqli_fetch_array($result)) {
if($row['del']==1){
$sql1="select count(*) from notes where lead_id='$row[lead_id]'";
$var=mysqli_query($conn,$sql1);
$var=mysqli_query($conn,$sql1);
$var1=mysqli_num_rows($var);
?>
and below this php code is table which displays the data fetched by $row.The problem is I am not getting the correct count of rows.It shows 1 but I have multiple rows with same lead id