database - multiple sql queries on single php page -
i have code
<?php include("db.php"); $sql="select * lead"; $result=mysqli_query($conn, $sql); $i=0; ?> <?php while($row=mysqli_fetch_array($result)) { if($row['del']==1){ $sql1="select count(*) notes lead_id='$row[lead_id]'"; $var=mysqli_query($conn,$sql1); $var=mysqli_query($conn,$sql1); $var1=mysqli_num_rows($var); ?>
and below php code table displays data fetched $row.the problem not getting correct count of rows.it shows 1 have multiple rows same lead id
you call $sql1="select count(*) notes lead_id='$row[lead_id]'";
and have $var=mysqli_query($conn,$sql1); $var1=mysqli_num_rows($var);
but mysql_query return 1 row count(*)
.
have $sql1="select * notes lead_id='$row[lead_id]'";
and call mysqli_num_rows($var);
Comments
Post a Comment