public static function closeConnection() { if (isset(self::$connection)) { mysql_close(self::$connection) or die(mysql_error()); } self::$connection = null; }
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; }
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; }