ANYTIME you <cfoutput query="">stuff</cfoutput> it will ONLY do the stuff if
the query contains AT LEAST ONE RECORD.
If you want it to do something else if it is empty, you must program it ...
<cfif check_registration.recordcount is 0>
No Hits
<cfelse>
<cfoutput query="check_registration">
do stuff
</cfoutput>
</cfif>
Jevo
-----Original Message-----
From: Daniel Kessler [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 17, 2004 12:26 PM
To: CF-Talk
Subject: failing when query is named.
I have a query that when the query returns something, it does the
stuff in the <cfoutput Query = "check_registration"> section. When
it returns no hits, it totally skips the cfoutput. I'm new to cf and
dbs but our cf guy here says it should do the cfoutput no matter what
and then it should properly do the iff to test whether something was
returned.
So, could someone explain to me why this fails when no records are
returned, but if I take out the Query = "check_registration" and
leave the cfouput, it works fine? I told him that I'd relay the
answer, but would also like a better understanding myself. My code:
<cfquery name="check_registration" datasource="css-cffa-sites">
SELECT *
FROM bodyfun_registry
WHERE userName = '#Form.userName#'
</cfquery>
<cfoutput Query = "check_registration">
in query
<cfif check_registration.userName eq '#Form.userName#'>
okey, done
<cfelse>
aw, so messed up
</cfif>
</cfoutput>
--
Daniel Kessler
Department of Public and Community Health
University of Maryland
Suite 2387 Valley Drive
College Park, MD 20742-2611
301-405-2545 Phone
www.phi.umd.edu
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

