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 trial

PHP PHP & Databases with PDO PDO Database Security PDO Security

Incorrect answer is set to "What do I need to call on a PDOStatement object after I've bound the parameters?"

Between the three answer options of execute(), query(), and exec(), the most correct answer is execute to the following questions: "What do I need to call on a PDOStatement object after I've bound the parameters?"

In my local PHP environment pre-installed with Yosemite, the PHP environments I'm used to, and my previous familiarity with MYSQLi and PDO, the challenge seems to accept an incorrect answer if execute isn't the correct answer.

Perhaps Hampton Paulk can chime in on this at his earliest convenience.

I noticed this too in another post (https://teamtreehouse.com/forum/wrong-answer-is-the-right-answer-in-quiz-after-video). It definitely seems like an error and another mod stated he was contacting support about it.

2 Answers

Rob Allessi
Rob Allessi
8,600 Points

Howdy folks! Please see this thread where Hampton touches on this same issue: https://teamtreehouse.com/forum/wrong-answer-is-the-right-answer-in-quiz-after-video

execute() is the correct answers with my experience with PDO you only use exec() if you want to actually place the sql statement within the method to reduce the number of lines i.e. db->exec("SELECT * FROM actors");

Andrew Shook
Andrew Shook
31,709 Points

Yeah I've always call execute too.