Subquestions codes

4 years 1 week ago #114420 by Allan
Allan created the topic: Subquestions codes

I need to retrieve subquestions codes from Limesurvey database in the context of php codes launched after a survey is completed (to display charts based on survey results).

Unfortunately I don't see any fields in lime-questions or in lime_answers containing those codes and I don't see any table named lime_subquestions.

In a previous version of Limesurvey (1.86) I used to use the field lime_answers.code and it worked fine. But as I am currently testing the last version of LimeSurvey (2.05+) this field doesn't contain anymore the right value which matches now with subquestion code.

Does anyone know where subquestion codes are stored in Limesurvey database ?

Thanks to the community

Please Log in or Create an account to join the conversation.

4 years 6 days ago #114465 by Mazi
Mazi replied the topic: Subquestions codes
This gets the answers options for single choice questions like list radio:
"SELECT DISTINCT(`code`) FROM ".$dbprefix."answers WHERE `qid`=$qid";

To get the subquestions e.g. for a multiple choice question use:
"SELECT `title` FROM ".$dbprefix."questions WHERE `parent_qid`=$qid";

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)'"
The following user(s) said Thank You: Allan

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!