|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: abdulazeez alugo (defatigue
hotmail.com)
Date: Tue Apr 07 2009 - 10:43:44 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Alright guys,
I just solved the problem. I read from somewhere that if you're using a foreign key, it should be the either the primary key in the table or the index so since I already used auto increment on table2_id and I've already made it my Primary key, I just made table1_id the index and it returned successful. So that was the problem all along.
Thanks for your suggestions.
Best regards
Alugo Abdulazeez.
> From: defatigue
hotmail.com
> To: spap13
googlemail.com
> CC: mysql
lists.mysql.com
> Subject: RE: PHP-MYSQL Question
> Date: Tue, 7 Apr 2009 15:32:25 +0100
>
>
>
> I've done that but it still gives the same error message.
>
>
>
>
> Date: Tue, 7 Apr 2009 16:25:15 +0200
> Subject: Re: PHP-MYSQL Question
> From: spap13
googlemail.com
> To: defatigue
hotmail.com
> CC: mysql
lists.mysql.com
>
>
> it is not the ENGINE as Eugene mentioned above, is that you need to use UNSIGNED when creating the second table
>
>
> CREATE TABLE table2 ( table2_id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
> table1_id INT UNSIGNED NOT NULL,
> name VARCHAR(100) NOT NULL,
> school VARCHAR(100) NOT NULL,
> comment TEXT NOT NULL,
> entrydate TIMESTAMP NOT NULL,
> FOREIGN KEY(table1_id) REFERENCES table1(table1_id))
> ENGINE = INNODB
>
>
>
> _________________________________________________________________
> Show them the way! Add maps and directions to your party invites.
> http://www.microsoft.com/windows/windowslive/products/events.aspx
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]