The main problem is your database structure.
You have one month but many actions for each month in the same table.
Try this:
table month:
monthID, monthName
table action:
actionID, monthID, actionName
Then use these queries( i am sure some sql whiz can think of a join that would make this more efficient )
$query="select * from month";
$result=mysql_query($query);
$numRows=@mysql_num_rows($result);
for($i=0;$i<$numRows;$i++){
$record=@mysql_fetch_array($result);
echo $record->montName."<br />";
$query="select * from action where monthID=$record->monthID";
$result2=mysql_query($query);
$numRows2=@mysql_num_rows($result2);
for($j=0;$j<$numRows2;$j++){
$record2=@mysql_fetch_object($result2);
echo "
$record2->actionName<br />";
";
}
}
This first gets all the monthName and monthIDs from the month table.
It then starts a loop that displays the month name once.
The next query gets the actionName and actionIDs from the action table.
It then starts a loop with in the first loop to display just the action for that month.
The whole process starts over for each month.
This will build the display that you are looking for.