rinteractive Posted December 21, 2007 Share Posted December 21, 2007 This is my code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $con = mysql_connect("localhost","root",""); if(!$con) { echo"Connection failed".mysql_error(); } mysql_select_db("sample",$con); $sql="CREATE TABLE member ( id int(11) NOT NULL auto_increment, membership_no varchar(100) , refcode varchar(100), post varchar(100), photo varchar(100), cat int(11), name varchar(100), head int (11), date_of_birth date, Gender varchar(10), profession varchar(50), nationality varchar(30), education varchar(30), familydetails1 varchar(50), familydetails2 varchar(50), address1 varchar(100), address2 varchar(100), telephoner int (15), telephoneo int (15), mobile int (15), email varchar(80), policestation varchar (70), municipalityoffice varchar(100), detailsofbank varchar(100) date1 date, place varchar(30), PRIMARY KEY (id), KEY `membership_no` (`membership_no`) )"; mysql_query($sql,$con); mysql_close($con); ?> </body> </html> the table is not creating Could any one help me Quote Link to comment https://forums.phpfreaks.com/topic/82651-solved-creating-mysql-table-using-php/ Share on other sites More sharing options...
chigley Posted December 21, 2007 Share Posted December 21, 2007 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $con = mysql_connect("localhost","root",""); if(!$con) { echo"Connection failed".mysql_error(); } mysql_select_db("sample",$con); $sql="CREATE TABLE member ( id int(11) NOT NULL auto_increment, membership_no varchar(100) , refcode varchar(100), post varchar(100), photo varchar(100), cat int(11), name varchar(100), head int (11), date_of_birth date, Gender varchar(10), profession varchar(50), nationality varchar(30), education varchar(30), familydetails1 varchar(50), familydetails2 varchar(50), address1 varchar(100), address2 varchar(100), telephoner int (15), telephoneo int (15), mobile int (15), email varchar(80), policestation varchar (70), municipalityoffice varchar(100), detailsofbank varchar(100) date1 date, place varchar(30), PRIMARY KEY (id), KEY `membership_no` (`membership_no`) )"; mysql_query($sql,$con) or die(mysql_error()); mysql_close($con); ?> </body> </html> Try that (mySQL will report errors now) Quote Link to comment https://forums.phpfreaks.com/topic/82651-solved-creating-mysql-table-using-php/#findComment-420353 Share on other sites More sharing options...
rinteractive Posted December 21, 2007 Author Share Posted December 21, 2007 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $con = mysql_connect("localhost","root",""); if(!$con) { echo"Connection failed".mysql_error(); } mysql_select_db("sample",$con); $sql="CREATE TABLE member ( id int(11) NOT NULL auto_increment, membership_no varchar(100) , refcode varchar(100), post varchar(100), photo varchar(100), cat int(11), name varchar(100), head int (11), date_of_birth date, Gender varchar(10), profession varchar(50), nationality varchar(30), education varchar(30), familydetails1 varchar(50), familydetails2 varchar(50), address1 varchar(100), address2 varchar(100), telephoner int (15), telephoneo int (15), mobile int (15), email varchar(80), policestation varchar (70), municipalityoffice varchar(100), detailsofbank varchar(100) /* forgot here to put camma (,) */ date1 date, place varchar(30), PRIMARY KEY (id), KEY `membership_no` (`membership_no`) )"; mysql_query($sql,$con) or die(mysql_error()); mysql_close($con); ?> </body> </html> Thanks you for replying me Quote Link to comment https://forums.phpfreaks.com/topic/82651-solved-creating-mysql-table-using-php/#findComment-420361 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.