I had this previously in my normal mysql_* connection:
mysql_set_charset(\"utf8\",$link); mysql_query(\"SET NAMES \'UTF8\'\");
Do I need it
I test this code and
$db=new PDO('mysql:host=localhost;dbname=cwDB','root','', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); $sql="select * from products "; $stmt=$db->prepare($sql); $stmt->execute(); while($result=$stmt->fetch(PDO::FETCH_ASSOC)){ $id=$result['id']; }