I have this class:
<?php
class LLPDO extends PDO{
public function __construct($dsn, $user, $pass, $options = array()){
$this->link = parent::__construct($dsn, $user, $pass, $options);
$this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
public function isConnected(){
try {
$this->link->query('SELECT 1+1');
} catch (PDOException $e) {
return false;
}
return true;
}
}
?>
But when I make a call like so:
if(!$ibdb.isConnected()){
$ibdb = new LLPDO(connectionString2($ini['ibdbn'], $ini['ibdbclient'], $ini['ibdbport']), $ini['ibdbusr'], $ini['ibdbpass'], array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
I get a Fatal error: Call to undefined function isConnected(). Am I calling the function wrong? Or did I do something incorrect in the class file? $ibdb
was created ahead of time earlier in the script I'm running it in.