[thelist] ColdFusion query questions
matthew
thelist at imagerealm.com
Wed Dec 3 11:41:17 CST 2003
> From: Kelly Hallman khallman at ultrafancy.com
> I understand how to run a query with CFQUERY, and how to output the
> results with CFOUTPUT ... how do I check/manipulate the results, and/or
> know if there were any results, or if there was a query error?
>
> For instance, if I want to SELECT and see if there was any matching rows?
> How do I loop/test them without outputting them? What if I did an INSERT
> that failed due to a table constraint, how do I test for that?
This is the only example that I have time to give right now...
<cfif queryName.recordCount GT 0>
<cfoutput query="queryname">
<p>#queryname.field1#, #queryname.etc#</p>
</cfoutput>
<cfelse>
<p>No results found.</p>
</cfif>
Hopefully someone else can give more complete answers later.
Good luck,
Matt
More information about the thelist
mailing list