Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
Question2Answer query failed:

INSERT INTO qa_posts (categoryid, type, parentid, userid, cookieid, createip, title, content, format, tags, notify, created) VALUES (_utf8 '', _utf8 'Q', NULL, _utf8 '1', NULL, INET_ATON(_utf8 ''), _utf8 'fse fsef esfsefsefesfesfse', _utf8 '', _utf8 '', _utf8 '', _utf8 '@', NOW())

Error 1452: Cannot add or update a child row: a foreign key constraint fails (`surakz5_surak/qa_posts`, CONSTRAINT `qa_posts_ibfk_3` FOREIGN KEY (`categoryid`) REFERENCES `qa_categories` (`categoryid`) ON DELETE SET NULL)
What version are you using?
1,4- beta 1. This is a mistake, too, you have to go on this site.

1 Answer

0 votes
Best answer

OK, got it. This happens when you ask a question via the ask box widget, rather than via the 'Ask a Question' navigation link.

The solution is to add these lines in qa-page-ask.php, before the comment "Check for permission error":

if (!isset($categories[$incategoryid]))
This will of course be fixed in the next release.