我正在尝试从 php 为我的数据库创建表。我有点想建立一个社交网站,无论如何,我编写了代码并且正在工作,但是新表不会在数据库中创建,我不知道代码似乎有什么问题。帮助将不胜感激谢谢!
<?php
$host = "host";
$user = "user";
$pswd = "password";
$dbnm = "db";
$conn = @mysqli_connect($host, $user, $pswd, $dbnm);
if (!$conn)
die ("<p>Couldn't connect to the server!<p>");
$selectData = @mysqli_select_db ($conn, $dbnm);
if(!$selectData)
{
die ("Database Not Selected");
}
$sql = "CREATE TABLE IF NOT EXIST 'friends'
(
'friend_id' INT NOT NULL auto_increment,
'friend_email' VAR CHAR(20) NOT NULL,
'password' VAR CHAR(20) NOT NULL,
'profile_name' VAR CHAR(30) NOT NULL,
'date_started' DATE NOT NULL,
'num_of_friends' INT unsigned,
PRIMARY KEY ('friend_id')
)";
$query_result = @mysqli_query($conn, $sql);
mysqli_close($conn);
?>