foreach ($timetableFactPrepared as $key => $row) {
if (!array_key_exists($row['date_shift'], $listDateCount)) {
$listDateCount[$row['date_shift']] = 1;
- $timetableFact[$key] = $row;
- $timetableFact[$key]['date'] = $row['date_shift'];
+
+ } else {
+ $listDateCount[$row['date_shift']] = $listDateCount[$row['date_shift']] + 1;
}
+ $timetableFact[$key] = $row;
+ $timetableFact[$key]['date'] = $row['date_shift'];
}
}
$post = \yii\helpers\Json::encode($postJson);
$post = str_replace('"', '\'', $post);
$app->db->createCommand(
- 'INSERT INTO page_statistics (admin_id, url, post, created_at) VALUES (\'' . $_SESSION['admin_id'] . '\', \''
+ 'INSERT INTO public.page_statistics (admin_id, url, post, created_at) VALUES (\'' . $_SESSION['admin_id'] . '\', \''
. $url . '\', :post, NOW())'
)->bindParam(':post', $post, PDO::PARAM_STR)->execute();
}