Hi all,
Hoping you can assist. I am probably starring at the darn thing but i cannot see the wood through the trees :)
class headScript
{
public function connection()
{
try
{
$dbh = new PDO("mysql:host=localhost;dbname=xxx", 'xxx', 'xxx'); // Dev
return $dbh;
}
catch(PDOException $e)
{
echo "Error :- " . $e->getMessage();
die();
}
}
public function headLoad()
{
$cxn = $this->connection()->prepare("SELECT scriptCode FROM head_scrips WHERE active = '0'");
$cxn->execute();
$cxn->setFetchMode(PDO::FETCH_ASSOC);
print "<script>";
while($row = $cxn->fetch())
{
print $row['scriptCode'];
}
print "</script>";
}
}
I have this basic class, it will get all active scripts from the database.
I am using this to relay hte data to the page head:
$scriptOut = new headScript;
print $scriptOut->headLoad();
I am getting the <script>
tags rendered but no script
Can you assist?