I’m having an issue with displaying exam subjects and results for the third term in my PHP application. The subjects and results data are correctly populated in an array, but they are not showing up in the final output.
Here’s a brief overview of what I’m trying to achieve:
-
Data Retrieval:
I am retrieving exam subjects and results for the third term from the database. The data seems to be correctly fetched as I can see it in the array. -
Data Structure:
The data for the third term subjects is structured as follows:
Exam Subjects for THIRD TERM: Array
(
[0] => stdClass Object
(
[id] => 15687
[school_id] => 2
[exam_id] => 7
[class_id] => 1
[section_id] => 8
[subject_id] => 74
[academic_year_id] => 1
[student_id] => 149
[grade_id] => 1
[written_mark] => 20
[written_obtain] => 18
[tutorial_mark] => 0
[tutorial_obtain] => 0
[practical_mark] => 40
[practical_obtain] => 26
[viva_mark] => 40
[viva_obtain] => 30
[exam_total_mark] => 100
[obtain_total_mark] => 74
[remark] => Excellent!
[status] => 1
[created_at] => 2024-08-03 08:15:49
[modified_at] => 0000-00-00 00:00:00
[created_by] => 314
[modified_by] => 0
[subject] => BUSINESS STUDIES
[point] => 5.00
[name] => A
)
[1] => stdClass Object
(
[id] => 15768
[school_id] => 2
[exam_id] => 7
[class_id] => 1
[section_id] => 8
[subject_id] => 62
[academic_year_id] => 1
[student_id] => 149
[grade_id] => 1
[written_mark] => 20
[written_obtain] => 16
[tutorial_mark] => 0
[tutorial_obtain] => 18
[practical_mark] => 40
[practical_obtain] => 15
[viva_mark] => 40
[viva_obtain] => 37
[exam_total_mark] => 100
[obtain_total_mark] => 86
[remark] => Excellent!
[status] => 1
[created_at] => 2024-08-03 08:13:37
[modified_at] => 0000-00-00 00:00:00
[created_by] => 314
[modified_by] => 0
[subject] => BASIC SCIENCE
[point] => 5.00
[name] => A
)
…
)
Issue:
Despite the subjects being correctly populated in the array, they are not showing up in the HTML output. The array seems fine when printed, but the data does not appear where expected.
Can anyone provide insights or suggestions on what might be causing the third term results to not display? Any help would be greatly appreciated!
Thank you!
I’ve tried the following:
- Verified the structure of $examSubjects and $exams. Seems fine
- Added debugging statements to check the array content before the loop
I was expecting the data for third term to be missing, it was present in the array, however, it does not display in the HTML output.
Ephrata is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.