I have a tables with many actions, a field is "created" with the datetime of the action. I need to get back an array with how many actions I registered per HOUR, WEEK DAY, DAY, MONTH in a periode range.
Is better doing a unique db request and parsing all results
foreach($scans as $s) {
$data['total']++;
$t = strtotime($s['Scan']['created']);
//week day
@$data['weekday'][date('w',$t)]++;
@$data['hour'][date('H',$t)]++;
@$data['day'][date('d',$t)]++;
@$data['month'][date('n',$t)]++;
}
or 5 queries with count() function? Thanks