Registered courses table, and commenting

Fixed the SQL query that is used to populate a table of the user’s
registered courses.
Added some comments to the code.
Refactored the PHP code so that it is easier to understand.
Merge branch 'Jordan's-Branch'