Hello every body
Please help me to write this code
i want to display table like this

Generated from three database tables depends on student ID


So i want to display this table without any fixed value of exams or subjects .. just i want the idea of looping

And is this the best way to insert the students marks?? coz by this way if i have 5000 student and 10 subjects and 12 exam in year .. i will have mor than 500.000 record in table Stu_Marks

sorry for my english language