0
What is the difference between these 2 ways to set the charset in the communication with the bank?
$pdo = new PDO("mysql:dbname=qualuqer_db;host=localhost;charset=utf8", "root", "");
and
$pdo = new PDO("mysql:dbname=qualuqer_db;host=localhost", "root", "", array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET names utf8"));
There are no differences. The constant
MYSQL_ATTR_INIT_COMMAND
serves only to inform the PDO, that you want to run that command. Could be, for example,[PDO::MYSQL_ATTR_INIT_COMMAND => "SET sql_mode=''"]
– Valdeir Psr
@Valdeirpsr Ahh yes, thank you!
– Bruno
A vc will use the default charset that is set in the database the other you choose the formatting you want and as @Valdeirpsr said you can set other values, this only "overwrite" the database pattern
– Marcos Brinner