$pdo = new PDO( 'mysql:host=hostname;dbname=database;charset=utf8', 'username', 'password' ); $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);