find php group by using an array
Posted: Fri Mar 11, 2011 7:08 am
I have the php array like this:
I calculated the number of days in a given month like this:
How do i loop through the "$num_days" to calculate the SUM of time_spent using GROUP BY time_stamp where day=$day,month=$month,year=$year
Thank u.
Code: Select all
Array
(
[0] => Array
(
[time_stamp] => 1287484988
[date_time] => Tuesday, 19 October 2010 16:13:7
[day] => 19
[month] => 10
[year] => 2010
[time_spent] => 41
)
[1] => Array
(
[time_stamp] => 1287484662
[date_time] => Tuesday, 19 October 2010 16:7:41
[day] => 19
[month] => 10
[year] => 2010
[time_spent] => 215
)
)Code: Select all
$num_days = cal_days_in_month(CAL_GREGORIAN, $month, $year); Thank u.