dongzhuange2625 2016-10-31 14:33
浏览 51
已采纳

为什么表没有在phpmyadmin中创建[重复]

I have written these codes (if table doesn't exist) condition. The Database is fine however my table is not creating and there was not error. Can anyone help me?!

   $connect=mysqli_connect($host,$username,$password)or die("cannot connect");

$create=mysqli_query($connect,"CREATE DATABASE IF NOT EXISTS projectdb") or die (mysql_error());
mysqli_select_db($connect,"projectdb");

$info="CREATE TABLE IF NOT EXISTS info (
    id int NOT NULL auto_increment,
    contactEmail text NOT NULL,
    firstName varchar(50) NOT NULL,
    lastName varchar(50) NOT NULL,
    phone varchar(50) NOT NULL,
    phone text NOT NULL,
    dob date NOT NULL,
    address varchar(50) NOT NULL,
    country varchar(70) NOT NULL,  
    PRIMARY KEY(id),
    UNIQUE KEY ( id )
    )";

mysqli_query($connect,$info);
</div>
  • 写回答

1条回答 默认 最新

  • donglu0494 2016-10-31 14:40
    关注

    your phone column is duplicate. so use any one

    phone varchar(50) NOT NULL,
    phone text NOT NULL,
    

    Please use bellow :

    phone varchar(50) NOT NULL,
    

    or

    phone text NOT NULL,
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?