Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static $_connectionLink = null;
- private static $_connectionErrors = null;
- public function __construct() {
- if (empty(self::$_connectionLink)) {
- self::connect();
- $handle = fopen('connect.log','a');
- fputs($handle,"----------- NEW connect ".date('Y-m-d H:i')."----------- n");
- fclose($handle);
- }
- }
- private static function connect() {
- $host = 'localhost';
- $user = 'user';
- $password = 'pass';
- $dbName = 'dbname';
- self::$_connectionLink = @mysqli_connect($host,$user,$password,$dbName);
- if (!mysqli_connect_errno()) {
- mysqli_set_charset(self::$_connectionLink, 'utf8');
- } else {
- }
- }
Add Comment
Please, Sign In to add comment