Answer the question
In order to leave comments, you need to log in
How to correctly select the data for the year from the procedure?
Good afternoon! Tell me how to choose the correct reporting data for the year, not load the server and build a graph in Yii2? My process is very slow
$year = '2018'; // todo: get $year
$records = [];
for ($i = 1; $i <= 12; $i++) {
$m = $i < 10 ? "0{$i}" : $i;
$firstDay = date("Y-{$m}-01 00:00:00", strtotime("{$year}-{$m}-01"));
$lastDay = date("Y-{$m}-t 23:59:59", strtotime("{$year}-{$m}-01"));
$command1 = Yii::$app->db->createCommand("EXEC sp_GetRecipientPaymentsGroupedByServices @user = :p_user, @sd= :p_start, @ed= :p_end");
$command1->bindParam(":p_user", $user, PDO::PARAM_INT);
$command1->bindParam(":p_start", $firstDay, PDO::PARAM_STR);
$command1->bindParam(":p_end", $lastDay, PDO::PARAM_STR);
$records[] = $command1->queryAll();
}
Answer the question
In order to leave comments, you need to log in
Tell me how to choose
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question