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 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.