If the recordcount of the query is 0, I don't think the code between the
<cfoutput>-tags is processed. A better way to do it is:

<query name="checklogin" datasource="TheSource">TheQuery</query>

<cfif NOT checklogin.recordcount>
        <cflocation url="login.cfm?task=loginfailure">
<cfelse>
        <cflocation url="Main.cfm?UserID=#checklogin.UserID#">
</cfif>

rgds


* Holger Lockertsen, Solutions Developer, Horisont Information Systems AS
* Nedre Slottsgate 5, N-0157 OSLO, Noreg/Norway
* 23 31 03 04 / 91 83 20 51
* [EMAIL PROTECTED]   http://www.horisont.no/

NB! Horisont har fått nye nummer, og mitt INTERNNUMMER er: 23 31 03 04


-----Original Message-----
From: McDonald, David [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 05, 2000 3:15 PM
To: '[EMAIL PROTECTED]'
Subject: query.recordcount woes...


I have been trying to set up a username and password login, which is
working okay, except for the "failed login" scenario.  The <cfif> tag does
not
execute the <cflocation> tag for a failed login (ie. query.recordcount is
0).  I'm lost as to why.  Here's my code (called from a previous template
form supplying the username and password variables):

<cfquery datasource="fln" name="CheckLogin">
SELECT UserID, Username, Password, FirstName, LastName
FROM User
WHERE

<cfif Username is not "">Username='#Username#'</cfif> AND
<cfif Password is not "">Password='#Password#')</cfif>
</cfquery>


<cfoutput query="CheckLogin" maxrows=1>
<cfif CheckLogin.recordcount is 0>
        <cflocation url="login.cfm?task=loginfailure">
<cfelse>
        <cflocation url="Main.cfm?UserID=#UserID#">
</cfif>
</cfoutput>

If the recordcount is not equal to 0 (successful login), it works
beautifully, but if the recordcount is 0 (failed login), the
<cflocation url="login.cfm?task=loginfailure"> code does not execute, it
simply returns a blank page (with the cf server info displayed).

Anyone help me with this?  It seems very straightforward but has me stumped.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to