Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Designing Interfaces in PHP Introducing Interfaces Implement MySQL RepositoryInterface

How to use PDO inside of child of PDO?

I am not sure how to go about using PDO inside of a child of PDO for this task. Any pointers?


class sqlRepository extends PDO implements RepositoryInterface
   public function all($entity){

1 Answer

Can you give some more info on what you're struggling with? And what goes wrong? Which errors you're getting? What different solutions you tried?

I ended up solving the issue with the help of some other conversations from another question.

While I was a little unclear on the syntax for using methods within a child class I was mostly getting hung up in the challenge due to using PDO::prepare instead of PDO::query. The challenge only passed when using query with variables written directly into an sql statement vs a prepared statement.

Thanks for checking in on my issue, I appreciate your engagement and follow up.