• Register
Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Error 1452: Cannot add or update a child row: a foreign key constraint fails

+1 vote
987 views

I've setup Q2A with SSO following this tutorial. Unfortunately I get this error when I try to make a new question;

Question2Answer query failed:

INSERT INTO qa_posts (categoryid, type, parentid, userid, cookieid, createip, title, content, format, tags, notify, created) VALUES (NULL, _utf8 'Q', NULL, _utf8 '2', NULL, INET_ATON(_utf8 '121.125.237.17'), _utf8 'Will it blend?', _utf8 'Test', _utf8 '', _utf8 'money', _utf8 '@', NOW())

Error 1452: Cannot add or update a child row: a foreign key constraint fails (`theri_ATS`.`qa_posts`, CONSTRAINT `qa_posts_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `qa_users` (`userid`) ON DELETE SET NULL)

Please help me get this working.

Thanks,
A.T.

asked Feb 23, 2011 in Q2A Core by A.T.

1 Answer

+1 vote
 
Best answer
Solved by dropping rows begining with "qa_"
answered Feb 23, 2011 by A.T.
Could you tell the details (describe fault rows) and give a query to cure this error?
...