Peter are you quite sure about that?
You are saying a query object will not exist from a query that returns
no records?
Try running a query with no records and dumping the query object? Does
it complain of not existing or display an empty recordset? I think
you'll find it is the latter
Your logic doesn't quite stand up (and the syntax has been the subject
of a recent lengthy discussion).
If the recordcount is zero, then by your logic, the 'MyQuery' object
still won't exist and it will throw an error - which isn't the case
The test that Alex is performing is perfectly valid (although I do
actually do it the same way as you suggest Peter). Peter your syntax
is just a shortcut for saying 'does MyQuery.RecordCount have a value
other than zero' but again this isn't for discussion here as it won't
solve Alex's problem.
Alex - sorry to sidetrack there but didn't want you to get confused.
Try this piece of code:
<cfoutput>#risorse.recordcount#</cfoutput>
<CFIF risorse.recordcount IS NOT 0>
<cfdump var="#risorse#">
<a class="continuasmall"
href="#LINKRISORSE#?INSEGNAMENTO_ID=#UrlEncodedFormat(INSEGNAMENTO_ID)#"
target="_blank">#DESCRIZIONERISORSE#</a>
<cfelse>
<cfdump var="#risorse#">
<p>no risorse</p>
</CFIF>
do you get the cfdump when there are both some records and no records
(but the cfdump query object will have no records in the latter case)
?
If you get the dump in both cases, which you should, then this will at
least confirm that your conditional check is working ok?
As to why it won't output the <p>no risorse</p> I am not sure. You
could try putting <cfoutput><p>no risorse</p></cfoutput> around it but
I don't see why you should have to
On 10/27/06, Peter Tilbrook <[EMAIL PROTECTED]> wrote:
> If a CFQUERY returns no records it does not exist so there is no way to test
> for "zero" records as no result is produced.
>
> You need to tackle it along the lines of:
>
> <cfif MyQuery.RecordCount>
>
> Yes a result was made - ColdFusion has results ready to be handled.
>
> <cfelse>
>
> Na da. No response from the database (no records returned).
>
> </cfif>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:258245
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4