Also check the huntId variable.. in the select statement you use "CF_SQ_NUMERIC" and in the update statement you use "CF_SQL_VARCHAR" probably not the problem but for consistency..
On Wed, Mar 19, 2008 at 12:41 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: > dump the query or output the value of qWin.winner > > perhaps the values do not equal 0 > > > > On Wed, Mar 19, 2008 at 12:31 PM, Frank V. <[EMAIL PROTECTED]> wrote: > > Hey guys, I tried the what u guys told me.... Still not solved. The > > issue is that it keeps on going to ELSE, when NO WINNER has been > > specified. In my DataSource I have in the table DailyWin in column > > WINNER a default value of 0, so my query should check that if that value > > is 0 then inserts the value of WINNER in WINNER and send the user to the > > YOUWIN page, but right now all it's doing is sending the user to the TRY > > again page. > > > > I don't know if I'm being clear or not lol > > > > Frank Velazquez > > VicePresident > > [EMAIL PROTECTED] > > Office: 866.910.7327 EXT 302 > > Cell: 786.537.5460 > > Fax: 305.253.6435 > > > > > > > > > > > > > > -----Original Message----- > > From: Adrian Lynch [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 19, 2008 1:13 PM > > To: CF-Newbie > > Subject: RE: cfif issues. > > > > > > 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=#ur > > l.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:3461 Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
