Welcome Guest, Not a member yet? Register   Sign In
CI with MySQL client library 4.1.11 bug, mysql_set_charset does not exist resulting in blank pages
#2

[eluser]Michael Brooks[/eluser]
Here is my fixed version of the mysql driver's db_set_charset method, which seems to work for me:

Code:
function db_set_charset($charset, $collation)
{
    if ( ! isset($this->use_set_names))
    {
        // mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7 and MySQL client >= 4.1.13, use SET NAMES as fallback
        $this->use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') &&
            version_compare(mysql_get_server_info(), '5.0.7', '>=') &&
            version_compare(mysql_get_client_info(), '4.1.13', '>=')) ? FALSE : TRUE;
    }

    if ($this->use_set_names === TRUE)
    {
        return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
    }
    else
    {
        return @mysql_set_charset($charset, $this->conn_id);
    }
}


Messages In This Thread
CI with MySQL client library 4.1.11 bug, mysql_set_charset does not exist resulting in blank pages - by El Forum - 02-12-2012, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB