// 连接数据库
$mysqli = mysqli_connect("localhost","root","123",'student'); //mysqli_close($con);
$mysqli ? print 'yes!
':print "no!
";
$sql = $mysqli -> query('use student');
$sql = $mysqli -> query('set name utf8');
// 创建数据表
$sql = $mysqli -> query("create table hacker(
id char(6) not null,
name char(8) not null,
chinese float not null,
math float not null,
english float not null
)");
if($sql == true){
echo '成功创建hacker表!
';
}else{
echo '创建hacker表失败!'.$mysqli->error.'
';
}
// 添加数据——hacker
// $sql = "insert into hacker values('1','张三','10','20','30');";