0

Hi I made two tables in PHPmyadmin, I received this error when I tried to transfer the data into my database:

Error:Cannot add or update a child row: a foreign key constraint fails (poolfootball.choix, CONSTRAINT choix_ibfk_1 FOREIGN KEY (id_member) REFERENCES log_in (id_member) ON UPDATE CASCADE)

I think the only error is the data transfer from table log_in to choix. I have no problem with the table log_in. I already got my log_in table and the data transfer into the database works well. When I try to do the the same thing for table choix, I get this error. I'm trying to make this for entertainment. I will use this website with my friends only. Thank you for your help!

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • possible duplicate of [ERROR 1452: Cannot add or update a child row: a foreign key constraint fails](http://stackoverflow.com/questions/21659691/error-1452-cannot-add-or-update-a-child-row-a-foreign-key-constraint-fails) – Dipen Shah Jul 14 '15 at 20:06
  • you are trying to insert or update a record that would be orphaned. there's nothing to fix with your table structure. it is you doing inserts/updates incorrectly, or in the wrong order. – Marc B Jul 14 '15 at 20:16
  • I just want the data id_member from table log_in goes to table choix. The primary key of table log_in is id_member and the primary key of choix is id_member and week. – Jean-Philippe Lambert Jul 14 '15 at 20:22
  • I change the relation to restricted for update and delete and it still not work. – Jean-Philippe Lambert Jul 14 '15 at 20:24
  • Do you have an exemple of php code that could help me with that. I have an insert into choix the data from the table that must be enter but I still don't know how to enter the id_member from the table log_in into the code. I thought it will do it automatically when I configure the table in phpmyadmin. – Jean-Philippe Lambert Jul 14 '15 at 20:30

0 Answers0