Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
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 upRelated 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