title: Store in MySQL and display variable amount of rows in HTML table
body: <p>I'll try to explain the problem as best as I can, I'll put numbers on the problem to showcase it better but this might not be real:</p>
  
  <p>I have a little system where up to 2 teachers grade a student performing a task. The student will have to perform say 10 tasks, so in total the student is graded by up to 20 teachers.</p>
  
  <p>Each task shares some of the same questions but not all of them, say in Task1 teachers are presented with 10 grading points for example "1. Emphaty to patient:" then 5 radio buttons with which they grade the student. (A lowest, E highest).</p>
  
  <p>But then in Task2 there might not be a patient so that can't be graded. So we skip question 1 and maybe 2 and start at 3. So those questions are not displayed to the teacher. So we end up with a variable amount of gradings per task, some might have 5 some 10, etc.</p>
  
  <p>I have a table with the student info, another with the teachers info, task info (which includes questions to be asked in said task) and finally one with the evaluations:</p>
  
  <pre><code>+------------+------------+---------+---------------+-----+
  | id_student | id_teacher | id_task | grades        | ... |
  +------------+------------+---------+---------------+-----+
  | 1          | 2          | 4       | E,C,D,B,C,D,E |     |
  | 1          | 25         | 5       | A,E,B,C       |     |
  | 1          | 8          | 6       | E,D,C,C,D,D   |     |
  +------------+------------+---------+---------------+-----+
  </code></pre>
  
  <p>At first I thougt storing the grades separated by a comma would be ok, and then use php explode to retrieve it, it works for storing and displaying info per user per task and else but, first I don't know if this is good practice, second I'm now at the point of displaying the results for all students into a HTML table, but then how do I get the max amount of grades to decide the amount of the table fields and then how do I tell which grades goes where so I get:</p>
  
  <pre><code>+---------+---------+------+---------+------------+---------+-----+
  | Student | Teacher | Task | Grade 1 | Grade 2    | Grade 3 | ... |
  +---------+---------+------+---------+------------+---------+-----+
  | 1       | 2       | 4    | E       | C          | D       | ... |
  | 1       | 25      | 5    | NULL    | NULL       | A       | ... |
  | 1       | 8       | 6    | E       | D          | NULL    | ... |
  +---------+---------+------+---------+------------+---------+-----+
  </code></pre>
  
  <p>So finally the question is, is there a better way to aproach this? as in another table to store grades but then how to tell the amount of columns and finally how would be a better way to display it in HTML?</p>