I have a table where I want to count total entries in one column. But if the entire column is empty, I want the count to return 0 (meaning there are zero entries)
This is what I tried, but when I use echo it returns blank. In the database it is blank, but I want it to return 0 when column recall is empty.
CODE:
$chartsql = "SELECT recall from report where child_id='$childId'";
$ChartRes = mysqli_query($con,$chartsql);
while ($ChartRow=mysqli_fetch_array($ChartRes)){
$recall[] = $ChartRow['recall1'];
}
foreach($recall as $index=>$value) {
if($value === null) unset($recall[$index]);
}
$count_recall = count($recall);
if($count_recall = ''){
$count_recall1 = 0;
}
echo $count_recall;
Also, in the recall column, there are null entries as well as blank entries. So I want to ignore the nulls, but if all other entries are blank then it should return zero. If there are some blank and some valid entries, then it should only count the valid entries and not what is blank.
It should only return 0 if it is completely empty, ignoring nulls.