I have an associative array below:
$questions = array();
while ($selectedstudentanswerstmt->fetch()) {
$questions[$detailsStudentId][$detailsQuestionId] = array(
'questionno'=>$detailsQuestionNo,
'content'=>$detailsQuestionContent
);
}
Now I want to display the info here in a for each loop but my question is what should the foreach loop be called because I believe below is incorrect as it keeps saying questionno
and content
is undefined in the loop:
var_dump($questions);
foreach ($questions as $questionId => $question) {
//LINE 571
echo '<p><strong>Question:</strong> ' .htmlspecialchars($question['questionno']). ': ' .htmlspecialchars($question['content']) . '</p>' . PHP_EOL;
}
Notice: Undefined index: questionno in ... on line 571
Notice: Undefined index: content in ... on line 571