I am trying to use some remember me class , now the problem is i get
Call to a member function prepare() on a non-object
and i dont get any error's :
index.php :
try {
$connection = new PDO('mysql:host=localhost;dbname=ibids', 'root', '');
}
catch (PDOException $e)
{
printf ($e);
}
$storage = new Rememberme_Storage_PDO($connection);
$rememberMe = new Rememberme($storage);
i send the connection to this file : pdo.php and using there this code :
class Rememberme_Storage_PDO extends Rememberme_Storage_DB {
/**
*
* @var PDO
*/
protected $connection;
public function getConnection() {
return $this->connection;
}
public function setConnection(PDO $connection) {
try {
$this->connection = $connection;
}
catch (PDOException $e)
{
printf ($e);
}
}
}
And i have the error here on this function :
** this function inside Rememberme_Storage_PDO class
public function storeTriplet($credential, $token, $persistentToken, $expire=0) {
$sql = "INSERT INTO {$this->tableName}({$this->credentialColumn}, " .
"{$this->tokenColumn}, {$this->persistentTokenColumn}, " .
"{$this->expiresColumn}) VALUES(?, SHA1(?), SHA1(?), ?)";
$query = $this->connection->prepare($sql);
if(!$query->execute(array($credential, $token, $persistentToken, date("Y-m-d H:i:s", $expire))))
{
die('excute faild');
}
}
says :
Fatal error: Call to a member function prepare() on a non-object in F:\wamp\wwwememberme-master\src\Rememberme\Storage\PDO.php on line 44
I am newbie at PDO , what am i doing wrong ?