i am trying to count "YES" votes from column vote for each projects grouped by project_id. vote can be "YES", "NO" and null value which is a boolean value. i used "like" operator. but it is throwing error this is my table
here is the code
$sql = "SELECT COUNT(vote) as count,project_id FROM tbl_vote group by project_id where vote like '_Y'";
$result = $conn->query($sql); if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "count: " . $row["count"]. " project_id:".$row["project_id"]." <br>";
}
}
else {
echo "0 results";
}
error is in if condition
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\selection\compute_sums.php on line 18``