Displaying data from a linked table and displaying it as a list with HTML/PHP/MySQL
- by user1672694
I have three tables. 
students
studentID | FirstName | LastName | Email | Form  
course
CCode | Title  
courseenrolement
courseenrolementid | studentID | ccode | complete | scode
With the website, I have a page where I can view all the current enrolements and I wish to be able to view the list displaying the first name, surname and course title. I know I could do it with the following SQL (for the names):
SELECT FirstName, LastName FROM student, courseenrolement 
WHERE courseenrolement.studentID = student.studentID
But I am unsure how to get this to work using HTML/PHP. At present I only know how to display the studentID and CCode from the courseenrolement table using the following code:
<ul>
  <?php foreach ($courseenrolements as $ce): ?>
    <li>
      <form action="" method="post">
        <div>
          <?php htmlout($ce['studentID']); ?>
          <?php htmlout($ce['CCode']); ?>
          <input type="hidden" name="courseenrolementid" value="<?php
              echo $ce['courseenrolementid']; ?>">
          <input type="submit" name="action" value="Edit">
          <input type="submit" name="action" value="Delete">
        </div>
      </form>
    </li>
  <?php endforeach; ?>
</ul>
which displays this:
But I would like the names and course title. I managed to get it to show the names etc in the dropdown on the 'Add new' form, so I would assume it will be similar, but just unsure on how exactly. Thanks in advance