Guest User

Untitled

a guest
Mar 20th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. private static $_connectionLink = null;
  2. private static $_connectionErrors = null;
  3.  
  4. public function __construct() {
  5. if (empty(self::$_connectionLink)) {
  6. self::connect();
  7. $handle = fopen('connect.log','a');
  8. fputs($handle,"----------- NEW connect ".date('Y-m-d H:i')."----------- n");
  9. fclose($handle);
  10. }
  11. }
  12. private static function connect() {
  13. $host = 'localhost';
  14. $user = 'user';
  15. $password = 'pass';
  16. $dbName = 'dbname';
  17.  
  18. self::$_connectionLink = @mysqli_connect($host,$user,$password,$dbName);
  19. if (!mysqli_connect_errno()) {
  20. mysqli_set_charset(self::$_connectionLink, 'utf8');
  21. } else {
  22.  
  23. }
  24. }
Add Comment
Please, Sign In to add comment