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 Filter Input, Escape Output

I think the test to this section is incorrect

In the test it is ask what to call after the bindParam and 3 choices given query, execute and exec. I believe execute is correct, but the question wants exec as an answer.

2 Answers

Sometimes there are bugs in the quizzs. They are very rare though. Please try again and check if execute gives you the correct answer (I just did it and it was the correct answer for me).

Maybe it exec was wrongly the correct answer before and they fixed it now or some sort of weird bug...

Viki Pattanaik
Viki Pattanaik
6,314 Points

Yup you are right it was a bug in the quiz... Although it seems to be fixed now as I did not get this error. But here's a useful piece of information gathered from php.net:

PDO::exec actually exists as a method of the PDO class! It is used to execute an SQL statement that does not return any result set or in other words does not create a PDOStatement class (Returned value is simply an integer that tells you how many rows were affected by your SQL statement). It is therefore best used for SQL statements such as INSERT, UPDATE and DELETE.