Pdo_mysql is a mysql extension of PHP Data Objects (PDO) interface. Take a closer look at the PHP manual, but there are some interesting parameters to use, such as:
Pdo::mysql_attr_init_command (integer)
Command to execute when connecting to the MySQL server. Would automatically be re-executed when reconnecting.
When I use Pdo_mysql to connect to MySQL, I can use this parameter to automate some query. The most common use scenario is to connect MySQL using the utf-8 character set:
PLAIN TEXT
CODE:
$db = new PDO ("Mysql:dbname=dbname", "User", "password", Array (pdo::mysql_attr_init_command=> "SET NAMES UTF8"));
The code above will execute SQL immediately after connecting to MySQL:
PLAIN TEXT
CODE:
Set Namesutf8;
Author: Volcano
http://www.bkjia.com/PHPjc/486633.html www.bkjia.com true http://www.bkjia.com/PHPjc/486633.html techarticle Pdo_mysql is a mysql extension of PHP Data Objects (PDO) interface. Take a closer look at the PHP manual, but there are some interesting parameters to use, such as: Pdo::mysql_attr_init_comm ...