Hi all, i have been a fan of sitepoint for a while now.
I have come to a hard place and require a little assistance.
I have the following Class (file : headScript.php)
I'd like to remove the connection function and put this in its own file, then using namespace to pull this in. That way i have one file which can be called via namespace and i can use this function.
public function connection()
$dbh = new PDO("mysql:host=localhost;dbname=xxx", 'xxx', 'xxx'); // Dev
echo "Error :- " . $e->getMessage();
public function headLoad()
$cxn = $this->connection()->prepare("SELECT scriptCode FROM head_scripts WHERE active != '0'");
while($row = $cxn->fetch())
Am I thinking this is possible when it is not?
I have tried a few things but cant seem to get it to work.
Can anyone offer assistance?