PDOでcreate table

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$time_start = microtime(true);
$dsn = "mysql:dbname=equity;host=localhost";
$user = "hoge";
$password = "hogehoge";
  
try {
    $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e){
    print('connection failed:'.$e->getMessage());
}
 
$code= '2338';
 
$sql = "create table equity.code".$code."(
    id int unsigned auto_increment primary key,
    date int,
    close int
)ENGINE = MYISAM;";
$stmt = $dbh->query($sql);
 
$time = microtime(true) - $time_start;
echo "{$time}秒";