老是出现boolean false
<?php
try {
$pdo = new PDO('mysql:host = localhost;dbname = test', 'root', '');
//exec():执行一条sql语句返回受影响的记录的条数,去过没有受影响的记录,他返回0
//exec对select不起作用
$sql = <<<EOF
create table if not exists user(
id int unsigned auto_increment key,
username varchar(20) not null unique,
password char(32) not null,
email varchar(30) not null
);
EOF;
$res = $pdo ->exec($sql);
var_dump($res);
} catch (PDOException $e) {
$e ->getMessage();
}