Hi People.

Got a small issue, although its big for me........

I'm using phpmyadmin....

I have 2 tables....

My First table is 'user' which has 4 columns ( eventid, Name, Email, Address ) ( eventid is the primary key)

My Second table is 'trips' and it has 6 colums ( tripid, eventid, firsttrip, secondtrip, thirdtrip,fourthtrip ) (tripid is the primary key and eventid is the foreign key)

I made eventid as INDEX in the trips table.

Problem is while establishing relationships between theae 2 tables.

I clicked on the child table (trips) clicked on Relation View

And I get 2 dropdown lists

tripid is having these options....

     trips ---> tripid
     trips ---> eventid
     user ---> eventid

eventid is having these options....

     trips ---> tripid
     trips --->  eventid
     user ----> eventid

And then ON DELETE --> CASCADE ON UPDATE--> CASCADE

no matter what option i select I'm getting an error...

 Cannot add or update a child row: a foreign key constraint fails (`jauntyroads/trips`, CONSTRAINT `trips_ibfk_1` FOREIGN KEY (`eventid`) REFERENCES `trips` (`eventid`) ON DELETE CASCADE ON UPDATE CASCADE)

Any idea experts...??

Sorry for te lengthy post

Regards

Note, that some hosting providers do not allow foreign key relation. Check with their support to make sure.

I've changed from MyISAM to InnoDB...InnoDB does support foreign key thing... I've referred several youtube videos but still I'm getting this error of .......Cannot add or update a child row: a foreign key constraint fails

jauntyroads/trips

If the above is your fk name, it may cause the error. Switch the dash for an underscore.