From d280cc2cd1fb3d04e2e005e36625b4a4aa00ba34 Mon Sep 17 00:00:00 2001 From: GamesDev Date: Wed, 30 Jan 2013 10:50:46 +0300 Subject: [PATCH 1/2] Bug-fix db charset --- class.MySQL.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/class.MySQL.php b/class.MySQL.php index 7ec6107..092c986 100644 --- a/class.MySQL.php +++ b/class.MySQL.php @@ -33,6 +33,7 @@ class MySQL { var $username; // MySQL Username var $password; // MySQL Password var $database; // MySQL Database + var $charset; // MySQL Charset var $databaseLink; // Database Connection Link @@ -42,11 +43,12 @@ class MySQL { * Class Constructor * * *******************/ - function MySQL($database, $username, $password, $hostname='localhost'){ + function MySQL($database, $username, $password, $hostname='localhost', $charset='utf8'){ $this->database = $database; $this->username = $username; $this->password = $password; $this->hostname = $hostname; + $this->charset = $charset; $this->Connect(); } @@ -89,6 +91,9 @@ private function UseDB(){ $this->lastError = 'Cannot select database: ' . mysql_error($this->databaseLink); return false; }else{ + mysql_query("SET character_set_connection=".$this->charset); + mysql_query("SET character_set_client=".$this->charset); + mysql_query("SET character_set_results=".$this->charset); return true; } } From 0de2a245050a208a3b675e02c194dbcf2ff82ddb Mon Sep 17 00:00:00 2001 From: GamesDev Date: Tue, 12 Feb 2013 17:07:28 +0300 Subject: [PATCH 2/2] tiny helper for dev --- class.MySQL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class.MySQL.php b/class.MySQL.php index 092c986..1d5cbae 100644 --- a/class.MySQL.php +++ b/class.MySQL.php @@ -43,7 +43,7 @@ class MySQL { * Class Constructor * * *******************/ - function MySQL($database, $username, $password, $hostname='localhost', $charset='utf8'){ + function MySQL($database, $username='root', $password='', $hostname='localhost', $charset='utf8'){ $this->database = $database; $this->username = $username; $this->password = $password;