I am not a professional, just started learning PHP coding.
I am having some issues getting PDO to work inside a function. Hope someone will show me the correct way to code it inside a function.
function testKey($key){
// CHECK IF LINK IS AVAILABLE IN THE DATABASE
$result = dbConnect()->prepare("SELECT _uniq_key FROM _link_key WHERE 
_uniq_key= :1 AND _active= :2");
    $result->bindParam(':1', $key);
    $result->bindParam(':2', $o);
    $result->execute();
    $rows = $result->fetch(PDO::FETCH_NUM);
        if($rows > 0) {
            echo 'link is available';
            checkLink();
        }
        else 
        {
            echo 'link does not exist!';
        }
}
The PDO doesn't work correctly, and won't execute the PDO script.
 
     
     
    