Jump to content

Problem in Create a Database Table using SQL and PHP


varun7952

Recommended Posts

i m tryin to create table from mysql coding and when i run the script its runs without any errors and just show that its created table but whn i chk into phpmyadmin i cnt find my table there and also when i use some copy paste from some website its just do the same thing but this time table is created but i cant find any difference between my table and the website table but still my script wont work please help me where is the mistake

 

$connection=mysql_connect("127.0.0.1","root","");

$db=mysql_select_db("addressbook",$connection);

if($db){

 

 

$SQL="CREATE TABLE address_data_new

{

ID int(7) NOT NULL auto_increment,

First_name varchar(50) NOT NULL,                  ################## MY SCRIPT################

Last_name varchar(50) NOT NULL,

email varchar(50) NOT NULL,

PRIMARY KEY (ID),

UNIQUE Id (ID)

}";

 

/*

$SQL="create table address_data

{

ID int(7) NOT NULL auto_increment,                                          ############# working script############

First_Name varchar(50) NOT NULL,

Surname varchar(50) NOT NULL,

email varchar(50),

PRIMARY KEY (ID),

UNIQUE id (ID)

)";

 

*/

 

 

mysql_query($SQL);

mysql_close($connection);

echo "table added successfully";

}

else {

echo "database not found";

}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.