Hi everyone. I've been wrestling with this for a day and a half and I'm quite frustrated by now. I've got a database of events and I'm trying to display a list of months with the number of records in parenthesis next to it. i.e.:
February (1)
March (3)
April (0)
May (0)
etc..
I've had several starts at a few different methods of doing this, but they all hit one snag or another and I get stumped again. Here's a couple ways I've gone about this.
$query = "select count(*)from table_name group by month";
$result = mysql_query($query) or
die(mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
while (list ($key, $value) = each($row))
{
echo $row["month"];
echo "(".$value.") <br />";
}
}
$query = "select month from table_name";
$result = mysql_quary($query) or
die(mysql_error());
$row = mysql_fetch_array($result);
$count = count($row);
I'm positive this is full of horrible, horrible errors, bad syntax, etc. I think I've bitten off a little more than I can chew. Can someone point me back in the right direction? Hopefully I provided enough detail.