Right now the statement works, but I am only getting 1 category, and the correct amount of total categories that exist. When I remove the count, I get all 9 of my unique categories. How do I make it so that all of the categories are queried? I dont know why adding a count stops the query after one iteration.
$sql="SELECT DISTINCT category, COUNT(category) FROM tasks WHERE status=?";
$stmt = $conn->prepare($sql);
$stmt->bind_param('s',$_POST['status']);
$stmt->execute();
$stmt->bind_result($category,$count);
while($stmt->fetch()){
echo $category;
}
echo $count;