header("Content-Type:text/html;charset=utf8"); $dsn = "mysql:host=localhost;dbname=test;"; $db = new PDO($dsn, 'root', 'root',array(PDO::MYSQL_ATTR_INIT_COMMAND => "set names utf8")); $db->setAttribute(PDO::ATTR_CASE, PDO::CASE_UPPER); $rs = $db->query("SELECT * FROM foo"); $rs->setFetchMode(PDO::FETCH_ASSOC); $result_arr = $rs->fetchAll(); echo "<pre>"; print_r($result_arr);