On Friday 14 of April 2006 17:51, Vandegrift, Ken wrote:
> class WebDBConn {
>
> private static $instance = NULL;
>
> private function __construct() {
>
> self::$instance = new PDO($db, $user, $pwd);
> self::$instance->setAttribute(PDO::ATTR_ERRMODE,
> PDO::ERRMODE_EXCEPTION);
> }
>
> public static function getInstance() {
>
> if (!self::$instance) {
> self::$instance = new WebDBConn;
Here you overwrite your instance of PDO class with WebDBConn instance.
> }
> return self::$instance;
> }
> }
What you should do, is put the $instance initialization which you have in
__construct(), to the getInstance() method in place of 'self::$instance = new
WebDBConn'.
__construct() can be empty as you do not need an instance of WebDBConn
(everything is static).
Martin
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php