📅  最后修改于: 2020-09-30 05:44:32             🧑  作者: Mango
PHPmysql_query()函数用于创建表。从PHP5.5开始,不推荐使用mysql_query()函数。现在建议使用两种替代方法之一。
';
$sql = "create table emp5(id INT AUTO_INCREMENT,name VARCHAR(20) NOT NULL,
emp_salary INT NOT NULL,primary key (id))";
if(mysqli_query($conn, $sql)){
echo "Table emp5 created successfully";
}else{
echo "Could not create table: ". mysqli_error($conn);
}
mysqli_close($conn);
?>
输出:
Connected successfully
Table emp5 created successfully