Beispiel #1
0
 public static function closeConnection()
 {
     if (isset(self::$connection)) {
         mysql_close(self::$connection) or die(mysql_error());
     }
     self::$connection = null;
 }
Beispiel #2
0
 public static function getConnection()
 {
     if (self::$connection == null) {
         self::$connection = mysql_connect("localhost", "root", "") or die(mysql_error());
         mysql_select_db("chaoge") or die(mysql_error());
         mysql_query("set names utf8") or die(mysql_error());
     }
     return self::$connection;
 }
Beispiel #3
0
 public static function getConnection()
 {
     if (self::$connection == null) {
         self::$connection = mysql_connect('localhost', 'root', 'pisces228') or die(mysql_error());
         mysql_select_db('chaoge') or die(mysql_error());
         mysql_query('set names utf8') or die(mysql_error());
     }
     return self::$connection;
 }