Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Understanding Relationship Tables 3:41
- Relational Data 5 questions
- Querying Multiple Tables with JOIN 4:02
- JOINing Tables 1 objective
- Understanding SQL Injections 5:21
- SQL Injection 1 question
- Preparing SQL Statements 6:25
- Using a Prepared Statement 3 objectives
- Adding a Secondary Query 4:30
- Fetching in a While Loop 7:38
- Fetching Many Relationships 1 objective
Start a free Courses trial
to watch this video

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Our details page is lacking any people associated to the particular item: such as Authors or Directors. We want to pull all the people, with their roles, and add them to our catalog in a multidimensional associative array.
Example Code
try {
$result = $db->prepare("
SELECT fullname,role
FROM Media_People
JOIN People ON Media_People.people_id=People.people_id
WHERE media_id = ?");
$result->bindParam(1,$id,PDO::PARAM_INT);
$result->execute();
} catch (Exception $e) {
echo "bad query";
echo $e;
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Dennis Amiel Domingo
17,813 Points1 Answer
-
jlampstack
23,932 Points2 Answers
-
Amit Kumar
1,063 Points0 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up