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!

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 Queries & Results PDO Queries & Results

Wouldn't the answer be the query method? I can't get it right and yet the documentation also says query method.

I know from other PHP PDO videos you can run the exec method but I tried that also with no avail. Anyone have a clue on what the answer might be?


You don't say which question you're asking. But if it's "What method would you use on a PDOStatement object to bring back a result set?", then from the first video in this section you see that the query method returns a PDOStatement object. So the query method has already been used at this point and it has returned the PDOStatement object. So the question is asking which method you can use on the PDOStatement object to get a set of results. Watch the first 1 min 20sec of the second video in the section.

Okay so they were just being picky. It's a method so you do need the opening and closing curly braces on the method call. Oh and it's the query method.