I have the following relevant code:
try {
self::$db = new PDO($dsn, self::USER, SELF::PASS); //Connect to the database, and store the pdo object.
self::$db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e) {
throw new Exception("There have been an error in the connection: ". $e->getMessage());
}
When executing the static function this code is in, I get the following error:
Fatal error: Class 'SELF' not found in P:ath/to/script.php on line 107
I have no idea what might cause this, can anyone please enlighten me?
Thanks in advance.
Use self::PASS
instead of SELF::PASS
First line self
and SELF
isn't the same thing...
self::$db = new PDO($dsn, self::USER, self::PASS);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With