Here is my PHP database structure: http://pastebin.com/x89AdzfS
I've been trying for hours to get a JOIN SQL query using PDO to work but have failed, so I need some help here.
I need a PDO query that displays all the "assignments" (title and description) which are assigned to a class id that the student is also enrolled in.
Please tell me if you need me to be more specific. Thanks!
EDIT
Here's a query I did which displays the classes a person is in
$sql = $db->prepare("SELECT enrollments.*, courses.*, students.* FROM enrollments
LEFT JOIN courses ON enrollments.course_id = courses.id
LEFT JOIN students ON students.id = enrollments.student_id
WHERE enrollments.student_id = ?
");
$sql->execute(array($login_id));
while($row = $sql->fetch(PDO::FETCH_ASSOC))
{
echo "<li><a href='class.php?id=".$row['course_id']."'><i class='icon-book'></i>".$row['name']."</a></li>";
}
mysql_and has a low reputation!