MySQL Forums :: Quality Assurance :: connect two tables in mysql

Advanced Search

connect two tables in mysql
Posted by: Abubaker Theiban ()
Date: March 20, 2012 03:32AM

Hi all

I'm building my website in Dreamweaver.

I have create my database in localhost and it consist of 3 tables Guest , Room , Service.

Guest consist of:
ID , First Name , Second Name , Last Name , Mobile , E-mail , Age , Gender , Indentification ID , Arrival Date , Departure Date , Guest Number , Price.

Room Number , Guest Room , Family Room , Businessman Room.

Service ID , Meals Service , Communication Service , Mobility Service.

All I want is to connect the tables with each others so I put in the Guest table the primary key of Room (Room Number) , Service (Service ID) and I add them as INDEX in the options.

Then I start to test my website and when the explorer start it gives me the message :

Cannot add or update a child row: a foreign key constraint fails (`online hotel reservation system`.`room`, CONSTRAINT `room_ibfk_1` FOREIGN KEY (`Room Number`) REFERENCES `guest` (`Guest ID`))

I do not know what to do so please anyone help me.

Options: ReplyQuote

Subject Views Written By Posted
connect two tables in mysql 4544 Abubaker Theiban 03/20/2012 03:32AM
Re: connect two tables in mysql 1276 Abubaker Theiban 03/21/2012 06:44AM
Re: connect two tables in mysql 1091 david adams 03/30/2012 01:02AM
Re: connect two tables in mysql 1446 deepak m 03/27/2012 07:35AM
Re: connect two tables in mysql 1051 david adams 03/30/2012 01:04AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.