PHP Classes

And what about an create instance function like approximately...

Recommend this page to a friend!

      Prepare Statements DB Connection  >  All threads  >  And what about an create instance...  >  (Un) Subscribe thread alerts  
Subject:And what about an create instance...
Summary:Package rating comment
Messages:1
Author:Jean-Christophe
Date:2011-12-31 21:20:15
 

Jean-Christophe rated this package as follows:

Utility: Good
Consistency: Sufficient

  1. And what about an create instance...   Reply   Report abuse  
Picture of Jean-Christophe Jean-Christophe - 2011-12-31 21:20:16
And what about an create instance function like approximately this:
public static function getInstance(){
if (!self::$instance)
{
self::$instance = new PDO("mysql:host=$host;dbname=$dbname", 'root', 'PASSXXX');
self::$instance-> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$instance-> query("SET NAMES utf8");
}
return self::$instance;
}

And the special PDO insert or Update called: REPLACE INTO... can be util to !