I get this error:
Fatal error: Call to a member function prepare() on a non-object in /home/folder/public_html/includes/name.php on line 1768
This is the function:
function _FC_GET($typ, $data, $username){
global $dbh;
$stmt = $dbh->prepare("SELECT * FROM stats_clicks WHERE typ=:typ AND user=:username AND data=:data LIMIT 1;");
$stmt->bindParam(':typ', $typ);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':data', $data);
try {
$stmt->execute();
}
catch(PDOException $e) {
die( _OP_ERROR($e->getMessage(), __FILE__ ,__LINE__) );
}
$QUERY_DAT = $stmt->fetchAll();
return empty($QUERY_DAT['value']) ? 0 : $QUERY_DAT['value'];
}
And this is line 1768
:
$stmt = $dbh->prepare("SELECT * FROM stats_clicks WHERE typ=:typ AND user=:username AND data=:data LIMIT 1;");
I can't seem to find what is causing this. I use the $dbh-prepare();
statement in other functions in the same file.