Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Sql help cant find problem with this table
Old 05-14-2009, 05:29 AM Sql help cant find problem with this table
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
hi all,

need help trying make this table and keep getting an error but cant see the problem any help be good.

Code:
create table Register
(StudentID varchar(5) not null,
ClassID varchar(5) not null,
WeekID varchar(10) not null,
LessonID varchar(10) not null,
foreign key (StudentID) references student(StudentID),
foreign key (ClassID) references Classes(ClassID),
foreign key (WeekID) references Week(WeekID),
foreign key (LessonID) references Lessons(LessonID)
)
engine = innodb;

I think the problem is with the line foreign key (WeekID) references Week(WeekID),

error

Command failed: 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 'Week(WeekID), foreign key (LessonID) references Lessons(LessonI


Thanks
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
 
Register now for full access!
Old 05-14-2009, 03:44 PM Re: Sql help cant find problem with this table
Extreme Talker

Posts: 177
Trades: 0
I always hate these errors. All the foreign tables exist correct? and the fields they are referring to?
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 05-14-2009, 05:12 PM Re: Sql help cant find problem with this table
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
yes if i take the foreign key (WeekID) references Week(WeekID),
line out it works fine. Gone thought it loads making sure everythink is correct and just cant see why it wont work.
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Old 05-14-2009, 05:22 PM Re: Sql help cant find problem with this table
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Can you post the table structure for Week?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 05-14-2009, 05:30 PM Re: Sql help cant find problem with this table
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Code:
create table Week
(WeekID varchar(10) not null,
Week1 varchar(30) not null,
Week2 varchar(30) not null,
primary key (WeekID))
engine = innodb;
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Reply     « Reply to Sql help cant find problem with this table
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15106 seconds with 12 queries