MySQL error id 1452
#2

You're doing it all wrong! A foreign key (or simply relation) links two pieces of the same data together, that are in different tables. Userid needs to be linked with userid, not vehicleid with userid. That will never work.

Refer to this picture; here I link the player's weapons (child table) to the player's main data (parent table) by means of the player's unique identifier. The point of doing this is: in the event the userid gets changed or deleted, all rows in the child table(s) will also get updated or deleted.

Reply


Messages In This Thread
MySQL error id 1452 - by dusk - 26.02.2013, 15:53
Re: MySQL error id 1452 - by Vince - 26.02.2013, 16:13
Re: MySQL error id 1452 - by dusk - 26.02.2013, 16:20
Re: MySQL error id 1452 - by Vince - 26.02.2013, 16:46
Re: MySQL error id 1452 - by dusk - 26.02.2013, 16:59
Re: MySQL error id 1452 - by dusk - 26.02.2013, 17:20
Re: MySQL error id 1452 - by dusk - 27.02.2013, 12:10
Re: MySQL error id 1452 - by dusk - 27.02.2013, 15:58
Re: MySQL error id 1452 - by dusk - 27.02.2013, 19:45
Re: MySQL error id 1452 - by dusk - 01.03.2013, 09:39

Forum Jump:


Users browsing this thread: 1 Guest(s)