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 trialROBERT RUBY II
10,586 PointsUncaught Error: 'sqlRepository' not found
I am assuming there is a connection already here. I don't see where my error is in the code... is it the question or what am I doing wrong... code attached
<?php
class slqRepository extends PDO implements RepositoryInterface
{
public function all($table) {
// Prepare Query
$pdoS = $this->prepare('SELECT * FROM ?', [$table]);
// Execute Query
$pdoS->execute();
// Return feteched table
return $pdoS->fetchAll(PDO::FETCH_OBJ);
}
}
1 Answer
ROBERT RUBY II
10,586 PointsI figured it out by reading another discussion --- How to use PDO inside of child of PDO?
Must use query() and not do a prepared statement.