I have a table like this-
event (id,name,date)
I need a result set like this
$result = array(
'1'=>array(
array('id'=>2,'name'=>'foolball match','date'=>'2011-01-23'),
array('id'=>5,'name'=>'cricket match','date'=>'2011-01-27')
),
'3'=>array(
array('id'=>11,'name'=>'100 m run','date'=>'2011-03-12'),
array('id'=>27,'name'=>'Basket Ball','date'=>'2011-03-20'),
array('id'=>43,'name'=>'foolball match','date'=>'2011-03-29')
)
);
Here array keys (1,3) represents months (jan,mar).
Events will be stored under these month number key.
Here 2 is missing because there are no events in februry.
Can anybody please help me?
Try this