First, "it does not seem to be working properly" is not a useful description
of a problem. WHAT is it doing that makes you think it is not working
properly. You must explain yourself. I have sent over the link to the Smart
Questions page to you on many occasions, but clearly you still have never
read it. http://catb.org/~esr/faqs/smart-questions.html

Second, why aren't you using a list loop to loop over the list?

Third, the cfif is only going to do anything if the recordcount is 0, which
means the second query will never work.

Fourth, you ignored Bobby's advice to actually read a basic ColdFusion book.
Can I turn this into a plea? Can you please, please read a basic ColdFusion
book and a basic SQL book? Why won't you do this?



On Fri, Apr 25, 2008 at 9:17 AM, erik tom <[EMAIL PROTECTED]> wrote:

> >Your query is the unchanged. Instead of running the insert query, just
> >output the query to the screen so you can see what is going on.
> >
> >On a different not, I've also seen your last few questions to the list and
> >don't take this any other way than helpful, but you should really invest
> in
> >a good CF book.
> >
> >The latest CF Web Application Construction Kit (CFWACK) is a good start
> for
> >any CF beginner
> >
> >.:.:.:.:.:.:.:.:.:.:.:.:.
> >Bobby Hartsfield
> >http://acoderslife.com
> >http://cf4em.com
> >
>
> I rewrote the query but it does not seems to be working properly can anyone
> take a look at this and tell me whaqt is wrong
> <cfif isDefined("btnOption")>
>        <cfloop index="i"  from="1" to="#ListLen(form.opt)#">
>                 <cfset variables.this=ListGetAt(form.opt,i)>
>                         <cfquery name="getOptions2"
> datasource="cfelsunrise" dbtype="odbc" >
>        select id from questionOptions where questionid=#questionID# and
> surveyID=#surveyID# and options='#variables.this#'
> </cfquery>
>
>                <cfif getOptions2.recordcount eq 0>
>
>                        <cfquery name="qryOptionSave2"
> datasource="cfelsunrise" dbtype="odbc">
>                                 update questionOptions set
> options='#variables.this#' where id=#getOptions2.id#
>                        </cfquery>
>                </cfif>
>        </cfloop>
>
>
> </cfif>
> >
> >
> >I rewrote the query but it kepp updating the only one box . i dynamically
> >generate textboxes . that why it form.opt
> ><cfif isDefined("btnOption")>
> >        <cfloop index="i"  from="1" to="#ListLen(form.opt)#">
> >
> >                <cfset variables.this=ListGetAt(form.opt,i)>
> >                <cfquery name="getOptions" datasource="cfelsunrise"
> >dbtype="odbc">
> >                        Select * from questionOptions where id=#optionID#
> >order by id
> >                </cfquery>
> >                <cfif getOptions.recordcount eq 0>
> >                        <cfquery name="qryOptionSave"
> >datasource="cfelsunrise" dbtype="odbc">
> >                                SET NOCOUNT ON
> >                                        insert into questionOptions
> >values('#variables.this#',#questionID#,#surveyID#)
> >                                SET NOCOUNT OFF
> >                        </cfquery>
> >                <cfelse>
> >                        <cfquery name="qryOptionSave2"
> >datasource="cfelsunrise" dbtype="odbc">
> >                                update questionOptions set
> >options='#variables.this#' where  id=#optionID#
> >                        </cfquery>
> >                </cfif>
> >        </cfloop>
> >        <cflocation
> >url="addremoveQuestion.cfm?surveyID=#surveyID#&optionID=#optionID#"
> >addtoken="no">
> ></cfif>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:304235
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to