Created
October 25, 2012 10:52
-
-
Save kathangeorg/3951987 to your computer and use it in GitHub Desktop.
contenido UTF8 Server MYSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in die conlib/db_mysql.inc | |
/* public: connection management */ | |
function connect($Database = "", $Host = "", $User = "", $Password = "") { | |
/* Handle defaults */ | |
if ("" == $Database) | |
$Database = $this->Database; | |
if ("" == $Host) | |
$Host = $this->Host; | |
if ("" == $User) | |
$User = $this->User; | |
if ("" == $Password) | |
$Password = $this->Password; | |
/* establish connection, select database */ | |
if ( 0 == $this->Link_ID || !is_resource($this->Link_ID)) { | |
$this->Link_ID=@mysql_connect($Host, $User, $Password); | |
if (!$this->Link_ID) { | |
$this->halt("connect($Host, $User, \$Password) failed."); | |
return 0; | |
} | |
if ($this->Database != "") | |
{ | |
if (!@mysql_select_db($Database,$this->Link_ID)) { | |
$this->halt("cannot use database ".$Database); | |
return 0; | |
} | |
} | |
} | |
// change from here | |
mysql_query('SET character_set_client = latin1'); | |
mysql_query('SET character_set_results = latin1'); | |
mysql_query('SET character_set_connection = latin1'); | |
// to here | |
return $this->Link_ID; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment