• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Update Statement Help

New Here ,
Oct 08, 2007 Oct 08, 2007

Copy link to clipboard

Copied

What the page looks like:

quote:

<select name="score_identifierscore2" id="score_identifierscore2">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input name="score_identifier2" type="hidden" id="score_identifier2" value="V2.1">

<select name="score_identifierscore3" id="score_identifierscore3">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<input name="score_identifier3" type="hidden" id="score_identifier3" value="V3.1">

<input name="score_teacherid" type="hidden" id="score_teacherid" value="340">
<input name="score_teachername" type="hidden" id="score_teachername" value="Tony Teacher">
<input name="score_studentid" type="hidden" id="score_studentid" value="1">
<input name="score_vid" type="hidden" id="score_vid" value="3">
<input name="score_staid" type="hidden" id="score_staid" value="26">
<input name="totalrows" type="hidden" id="totalrows" value="3">


Insert Statement:

quote:


<cfoutput>

<cfloop index="I" from="1" to="#form.totalrows#" step="1">

<cfset score_identifierscore = "score_identifierscore" & I>
<cfset score_identifier = "score_identifier" & I >

<cfquery datasource="Some Source">
INSERT INTO voc_scores
(score_studentid, score_vid, score_staid, score_identifier, score_teacherid, score_studentname, score_identifierscore, score_teachername)

VALUES('#FORM.score_studentid#','#FORM.score_vid#','#FORM.score_staid#','#form[score_identifier]#','#FORM.score_teacherid#','#FORM.score_studentname#', '#form[score_identifierscore]#', '#form.score_teachername#')
</cfquery>

</cfloop>
</cfoutput>


I need help with an update statement:

I've tried several ways with no success, I would post the code, but I want a fresh outlook rather than the way I've been trying.

Thanks,
TOPICS
Advanced techniques

Views

443

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 09, 2007 Oct 09, 2007

Copy link to clipboard

Copied

What is the error you're seeing?

Are your fields score_studentid and score_teacherid really text values or are they numeric?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 09, 2007 Oct 09, 2007

Copy link to clipboard

Copied

numeric values

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 09, 2007 Oct 09, 2007

Copy link to clipboard

Copied

LATEST
VALUES('#FORM.score_studentid#','#FORM.score_vid#','#FORM.score_staid#','#form[score_identifier]#','#FORM.score_teacherid#','#FORM.score_studentname#', '#form[score_identifierscore]#', '#form.score_teachername#')
</cfquery>

Remove the single quotes around the #FORM.score_studentid# and #FORM.score_teacherid# and try it again. If any other fields are numeric in your database do the same.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation