Can someone help me rowCount() when I have values and empty values in mysql
for example:
id column1 column2 idcolumn
1 2 1
2 3 1
3 1 1
4 0 1
$CountQuery = "SELECT column1 FROM follow WHERE idcolumn= ?";
$Count = $dbh->prepare($CountQuery);
$Count -> execute(array($idcolumn)); //where $idcolumn = 1
$num_1 = $Count->rowCount();
echo $num_1;
this should give me a count of 4, but I’m trying to distinguish between column1 and column2, so I can find counts where if I wanted to create a query with $num_2, it should give me a count of 0.
Use
COUNT(column)to count the number of rows with non-NULL values in that column.