ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:setcharset

This is an old revision of the document!


setCharSer

Support for this command is limited to MySQL and Postgres databases, as of ADOdb V6, you can use the setConnectionParameter() parameter with any database that supports character set configuration.

Syntax
 bool function setCharSet(
      string $characterSetName
      )
      

Description

The function setCharSet() set the client side character set to the specified set. The function returns true or false based on the success of command execution.

Usage

$db->setCharset('utf8');

Workaround for setting server side character set on MySQL

$SQL =
 "SET character_set_results = 'utf8',
 character_set_client = 'utf8', 
character_set_connection = 'utf8',
 character_set_database = 'utf8', 
character_set_server = 'utf8'");
$db->execute($SQL);
v5/reference/connection/setcharset.1452991009.txt.gz · Last modified: 2017/04/21 11:33 (external edit)