The query attribute in <cfoutput> loops over the recordset. If the
recordcount is 0, it loops 0 times (isn't executed). I think that for
what you want, you need to check the recordcount:

<cfif check_registration.recordCount>

Pascal Peters
Certified ColdFusion MX Advanced Developer
Macromedia Certified Instructor
LR Technologies
Av. E. De Mot, 19
1000 BRUSSELS, BELGIUM
Tel: +32 2 639 68 70
Fax: +32 2 639 68 99
Email: [EMAIL PROTECTED]
Web: www.lrt.be

> -----Original Message-----
> From: Daniel Kessler [mailto:[EMAIL PROTECTED]
> Sent: woensdag 17 maart 2004 21:26
> 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]

Reply via email to