0001 function responses = mysql_get_responses(subject_id,response_table)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 query_responses = ['select * from ' response_table ' ' ...
0013 'left join `form` on (form.form_id = ' response_table '.form_id) ' ...
0014 'left join form_x_question on (form_x_question.form_id = form.form_id and ' ...
0015 'form_x_question.question_iteration = ' response_table '.question_iteration and ' ...
0016 'form_x_question.form_question_num = ' response_table '.form_question_num) ' ...
0017 'left join question on (question.question_id = form_x_question.question_id) ' ...
0018 'left join question_x_data_format on (question_x_data_format.question_id = question.question_id and ' ...
0019 'question_x_data_format.subquestion = ' response_table '.subquestion) ' ...
0020 'left join data_format on (data_format.data_format_id = question_x_data_format.answer_format_id) ' ...
0021 'where ' response_table '.subject_id = ''' subject_id ''' ' ...
0022 'order by ' response_table '.form_order, form_x_question.form_question_num']
0023
0024 [responses{1:41}] = mysql(query_responses)
0025
0026 return