hi,
I am working on survey App in this i have to collect answers i have one problem while saving multiplechoice with other type of question.
here while submitting answers with other it stores the ids and text together in other column. I would like to know how shall i have to separate numeric and non numeric values and save it in their respective column in database.
I am working on survey App in this i have to collect answers i have one problem while saving multiplechoice with other type of question.
Code:
<cfcase value="multiplechoicemultiother">
<cfif StructkeyExists(answer,"answerValue") AND NOT isNumeric(answer.answervalue) AND Find("other,",answer.answervalue)>
<cfquery name="insertresult">
INSERT INTO results (fkquestionid, fksurveyresultsid, other)
VALUES (
<cfqueryparam cfsqltype="cf_sql_int" value="#answer.questionid#">
,<cfqueryparam cfsqltype="cf_sql_int" value="#getResultid.id#">
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#answer.answervalue#">
)
</cfquery>
<cfelse>
<cfloop list="#answer.answervalue#" index="answervalue">
<cfquery name="insertresult">
INSERT INTO results (fkquestionid, fksurveyresultsid, fkanswerId)
VALUES (
<cfqueryparam cfsqltype="cf_sql_bigint" value="#answer.questionid#">
,<cfqueryparam cfsqltype="cf_sql_bigint" value="#getResultId.id#">
,<cfqueryparam cfsqltype="cf_sql_varchar" value="#answerValue#" list="true">
)
</cfquery>
</cfloop>
</cfif>
</cfcase>