I have a my SLQ database that looks like this:
COLUM1 COLUM2
adress1 | yes
adress2 | no
adress3 | yes
adress4 | maybe
adress5 | maybe
adress6 | yes
Now, I would like to count the number of times yes, maybe and no aprear in the colum. When I use the code here he only counts the "yes" word, so, this gives me a 3. Thats fine but I also need 2 other outputs, a 1 for the no and a 2 for the maybe-word. Can anyone help me out please?
$query = "SELECT colum2, COUNT(*) AS number FROM will GROUP BY colum2";
$result = mysql_query($query);
$obj = mysql_fetch_object($result);
echo "$obj->number";