Parajuli Sunil Parajuli Sunil - 1 month ago 10
MySQL Question

why table is not creating in 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);

Answer

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,