Click here to Skip to main content
16,018,818 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi im new to html and php and i made a file that connect to my mysql and i seem to get na error on my line 5 but im unsure of the error. anyone may have an idea?

the exact error i get is "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Email varchar(55) NOT NULL, D.O.B varchar(10) NOT NULL, Password varchar(1' at line 5"


mysql_connect('68.178.142.193', 'RootSpread', '*****')
or die (mysql_error());
mysql_select_db('RootSpread')
or die (mysql_error());
mysql_query("create table account(
firstname int(20) NOT NULL,
initial varchar(20) NOT NULL,
lastname varchar(20) NOT NULL
Email varchar(55) NOT NULL,
D.O.B varchar(10) NOT NULL,
Password varchar(18) NOT NULL,
ID int(11) NULL,
PRIMARY KEY (ID)
)") or die (mysql_error());
echo "Complete.";
?>

thanks in advance!
Posted
Updated 15-Jul-13 10:09am
v2
Comments
[no name] 15-Jul-13 16:02pm    
Looks to me like you missed a comma "lastname varchar(20) NOT NULL,"
Kevin Miqui 15-Jul-13 16:06pm    
now it says Incorrect database name 'D' im confused lol 0.o
[no name] 15-Jul-13 16:09pm    
The would be the "D.O.B" talking, I think.

1 solution

D.O.B is not a legal column name. Try [D.O.B] ... AND see the comment from ThePhantomUpVoter - you're definitely missing a comma
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900