Good day! Tell me, please, my brain does not want to work anymore ...
Using ArrayHelper :: map (), I bring my data to the $ hasanArray array
Array ( [N] => 12 [R] => 16 [S] => 21 ) The array has exactly this form - infa 100%
Then i try to refer to him
if ($hasanArray['R'] > $AVG['R'] + $sqr['R']) Then get
Undefined index: R Any ideas?
Code:
$query = 'SELECT pmh.scale, SUM(pht.value) as value FROM psy_hasan_tmp pht JOIN psy_mdl_hasan pmh' . ' ON pmh.question_id = pht.question WHERE pht.userid = :user GROUP BY pht.userid, pmh.scale'; $hasanArray = ArrayHelper::map(MdlPDOResults::findBySql($query, [':user' => $user])->asArray()->all(), 'scale', 'value'); $hasanStr = ''; if ($hasanArray['R'] > $AVG['R'] + $sqr['R']) $hasanStr .= 'V'; elseif ($hasanArray['R'] < $AVG['R'] - $sqr['R']) $hasanStr .= 'N'; else $hasanStr .= 'S';
print_rarray immediately after the helper is triggered - Alexey Shimansky