Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJAVIER MATHEU
19,456 Pointsbind
Why is this not OK?
<?php
function get_member($id) {
include("connection.php");
try {
$results = $db->prepare(
"SELECT member_id, email, fullname, level
FROM members WHERE member_id = ?"
);
$results->bindParam(1,$id,PDO::PARAM_INT);
$results->execute();
} catch (Exception $e) {
echo "bad query";
}
$members = $results->fetch();
return $members;
}
1 Answer
Zack Ball
4,958 PointsJavier,
It is probably expecting you to use $member_id and not just $id like from the workspace/videos that we've been using. It asks for $member_id so I'd stick with using that as the argument. The challenges can be fickle like that.