Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
515 views
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 '2.134.150.245'), _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)
by
What version are you using?
by
1,4- beta 1. This is a mistake, too, you have to go on this site.

1 Answer

0 votes
by
 
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]))
$incategoryid=null;
 
This will of course be fixed in the next release.
...