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

How to solve database error?

+2 votes
asked May 22, 2014 in Q2A Core by priyamani
edited May 26, 2014 by priyamani

i'm using Q2A with sigle sign on feature. It is working for admin user.  but i am getting the following error while posting, commenting and voting by other  users.


A Question2Answer database query failed when generating this page.

A full description of the failure is available in the web server's error log file.


 It is working fine without single sign on.

Q2A version: 1.6.3
commented May 27, 2014 by priyamani
yes.. there is no statements
commented May 27, 2014 by Scott
Does it show the SQL error if you have the setting QA_DEBUG_PERFORMANCE set to true in qa-config.php?
commented May 27, 2014 by priyamani
it shows the following  error in php_error_log file :

PHP Question2Answer MySQL query error 1452: Cannot add or update a child row: a foreign key constraint fails (`q2a`.`qa_userfavorites`, CONSTRAINT `qa_userfavorites_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `qa_users` (`userid`) ON DELETE CASCADE) - Query: INSERT IGNORE INTO qa_userfavorites (userid, entitytype, entityid, nouserevents) VALUES ('2', 'Q', 5, 0)
commented May 28, 2014 by priyamani
Thank you so much Scott and maxjtechno.  

i changed all foreign key reference as shared users table key. Now it is working fine.

Please log in or register to answer this question.