I am looking for a way to display data from a MySQL database across multiple columns in a similar fashion to a spreadsheet.
I have not started the table design as yet as I am unsure of the best approach to achieve what I would like.
I have considered the following:
TABLE 1 - Homework Task
id (INT)
task (VARCHAR)
This table is just a list of homework tasks
TABLE 2 - Students
id (INT)
studentName (VARCHAR)
This is just a list of students
TABLE 3 - Homework Grades
id (INT)
homeworkTaskId (INT)
studentId (INT)
grade (VARCHAR)
percentage (DECIMAL)
This will hold the marks for each homework task for each student
Now, what I would like to achieve is to be able to display the data like this:
What I am struggling with is my knowledge of SQL commands and knowing if it is possible to retrieve the data in such a way that I can loop through it to display in this format?
I am using PHP with a PDO connection to the MySQL database.
Many thanks in advance for any possible assistance in this matter.