<?php
//1.建立与数据库的连接,同时连接到数据库mysqli,还有就是
$mysqli=@new mysqli('localhost','root','3239551qq','test');
if ($mysqli->connect_errno){
die('Connect Error:'.$mysqli->connect_error);
}
//设计默认的客户端编码方式utf8
$mysqli->set_charset('utf8');
//3.执行SQL查询
$sql=<<<EOF
CREATE TABLE IF NOT EXISTS mysqli(
id TINYINT UNSINGED AUTO_INCREMENT KEY,
username VARCHAR(20) NOT NULL
);
EOF;
$res=$mysqli->query($sql);
var_dump($res);
//关闭数据库
$mysqli->close();
blowwind