Stick this in between the top query and the cfif:

<cfoutput>
#qWin.Winner EQUAL 0#
</cfoutput>

If that's false, it'll go to the else.

Also, a style note, you can write <cfif #qWin.Winner# EQUAL '0'> as <cfif
qWin.Winner EQ 0>. It's up to you though :)

Adrian

-----Original Message-----
From: Frank Velazquez
Sent: 19 March 2008 18:10
To: CF-Newbie
Subject: cfif issues.


Is this code correct??? I am trying to check a record in one of my data
sources, is this records equals 0 then proceeds to win page, else goes to
try again page. I am trying the code below, but it automatically goes to the
try again page. Can anyone help me?

CODE:

<cfquery name="qWin" datasource="Winners">
         SELECT   Winner
         FROM     DailyWin
         WHERE    HuntId = <cfqueryparam cfsqltype="CF_SQL_NUMERIC"
value="#url.HuntId#">
</cfquery>

<cfif #qWin.Winner# EQUAL '0'>
      <cfquery datasource="Winners">
               UPDATE DailyWin
               SET    Winner = <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="Winner">,
               WHERE  HuntId = <cfqueryparam cfsqltype="CF_SQL_VARCHAR"
value="#url.HunterId#">
      </cfquery>
      <cflocation
                url
="YouWin.cfm?HuntId=#qHunt.HuntId#&PrizeId=#qPrize.PrizeId#&HunterId=#url.Hu
nterId#"
                addToken = "No">
<cfelse>
      <cflocation
                url
="TryAgain.cfm?HuntId=#qHunt.HuntId#&PrizeId=#qPrize.PrizeId#&HunterId=#url.
HunterId#"
                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;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3457
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to