I have a few classes that perform some MySQL queries and prepared statements. However, I am lost in how to incorporate my PDO object within those classes. For example, I w
$dbh isn't within the scope of Foo, do this instead:
class Foo /*extends PDO*/
{
public $dbh;
public function __construct()
{
$dbh = new PDO(/*...*/);
}
public function bar()
{
$this->dbh->prepare('SELECT * FROM table');
return $this->dbh->execute();
}
}