Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make PDO run SET NAMES utf8 each time I connect, In ZendFramework

How to make PDO adapter run SET NAMES utf8 each time I connect, In ZendFramework. I am using an INI file to save the adapter config data. what entries should I add there?

If it wasn't clear, I am looking for the correct syntax to do it in the config.ini file of my project and not in php code, as I regard this part of the configuration code.

like image 622
Itay Moav -Malimovka Avatar asked Feb 25 '09 04:02

Itay Moav -Malimovka


1 Answers

fear my google-fu

$pdo = new PDO(     'mysql:host=mysql.example.com;dbname=example_db',     "username",     "password",     array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); 

first hit ;)

like image 192
SchizoDuckie Avatar answered Sep 28 '22 05:09

SchizoDuckie