Handle statistics case where query returns no posts
This commit is contained in:
parent
daeb7b709d
commit
522d208099
|
@ -30,6 +30,9 @@ class Statistics {
|
|||
$query = query($query) or error(db_error($query));
|
||||
$query_result = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if(empty($query_result))
|
||||
$query_result = [['hour' => 0, 'count' => "0"]];
|
||||
|
||||
// Get 24h array over post count
|
||||
$statistics_hour = array_fill(0,24,0);
|
||||
foreach ($query_result as &$hour_data) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user