PDO and MySQL with UTF-8
If you're using PDO, and facing dificulties with UTF-8 in your MySQL, even with everything setup to use UTF-8, you could try this:
$pdo = new PDO(
"mysql:host =localhost;dbname=databasename",
"user",
"pass",
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")
);
Written by Cristian Medeiros
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#