// Made this private again, really shouldn't call this outside the DB wrapper.
private static function getDB()
if (self::$connection === null)
// Correctly placed the settings array in the PDO constructor.
self::$connection = new PDO(
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)
catch (PDOException $e)
die($e->getMessage()); // We failed, die with the message.
// This should be correctly handled by an error handler in production code.
public static function prepare($query)
private static $connection;
Fatal error: Call to a member function prepare() on a non-object
This post has been edited by Yeronox: 15 July 2013 - 12:46 AM