Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating table in new database "renewals"

Status
Not open for further replies.

pendle666

Technical User
Jan 30, 2003
295
0
0
GB
Hello
I'm using the PHP/MySQL Dummies book to put together a database using MySQL 5.5.

Following the example I have created a database called "renewals" and typed in the following lines:

create table Member (
loginName varchar(20) not null,
createDate date not null,
password varchar(255) not null,
lastName varchar(50),
firstName varchar(50),
email varchar(255),
primary key (loginName) );


I'm getting an error message :

Error 1064 (42000) 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 "renewals

create table Member (
loginName varchar(20) not null,
createDate DATE n' at line 1



I'm a complete newbie at this, the text was typed in from the dummies book so I've no idea where I might have gone wrong. Can someone advise?

regards
Pendle

 
You're may be having trouble with the column named password. You can either try to enclose the field name in back tics

`password`

(btw: the back tic character just above the tab key on your keyboard)

or change the name to something else

passwrd
 

Thank you for your reply.

I've tried using passwrd and also the back tic on all the fieldnames but it's still giving me that same error message. It seems to not like something to do with the createdate.

But I've typed in everything as per the example, so I just don't understand what's happening!
 
Your SQL is fine, a copy an paste produces a table named Member without any errors.

Seeing as your create statement here doesn't have the string "renewals" anywhere in it, I find it strange it would be complaining about it.

Make sure there's nothing before the create statement, and that only the statement is there to be processed.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thanks for that Vacunita.

I'm just wondering if I've created the database correctly.

I typed

mysql> create database renewals
->

and then went onto type in the create table statemnet
 
hello

I've now solved the problem. I hadn't selected the database to use immediately after I created it. I did this and now the table is fine.

thanks
 
Glad you worked it out.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top