私の髪を引き裂く...次の配列の数字を合計する方法、これを試しましたが、うまくいきませんでした。ループ内でも試しましたが、何も得られません。そんなに難しくないと思いますが、なぜか取れません。
$sql = "SELECT queue_name,type,COUNT(uniqueid) AS calls FROM CallLog WHERE start_time BETWEEN '2013-10-14 00:00:00' AND '2013-10-14 23:59:59' GROUP BY queue_name, type";
$stmt=$dbh->prepare($sql);
$stmt->execute();
$calls = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($calls as $call){
$results[ $call['queue_name'] ][ $call['type'] ] = $call['calls'];
}
$totalCalls = array_sum($call['calls']);
echo '<pre>';
print_r($results);
echo '</pre>';
echo $totalCalls;
?>
Array
(
[Escalations] => Array
(
[abandoned] => 2
[completed] => 3
[redirected] => 1
)
[Premium] => Array
(
[abandoned] => 7
[completed] => 29
[redirected] => 6
)
[Standard] => Array
(
[abandoned] => 14
[completed] => 41
[redirected] => 53
)
[Wingate Queue] => Array
(
[abandoned] => 2
[completed] => 3
)
[WorldMark] => Array
(
[abandoned] => 32
[completed] => 100
[redirected] => 82
)
)