RecordCount within <CFIF> Statement...
Posted on 2004-04-20
Do recordcount commands work inside <CFIF> statements? I'm trying to just list people who have birthdays each day...but if there are no records queried for a birthday on a day, I want it to display we have no birthdays. Today for instance, we have nothing in the dbase with an 04/20 birthdate, so the query should have a recordcount of 0...so in my CFOUTPUT I have put if the recordcount = 0 to display "we have no celebrations today" ELSE display the names. Does this not work this way???
<!-- BEGIN QUERY SECTION -->
<cfset TodayDate = DateFormat(Now(), "M/D")>
<CFQUERY datasource="myds" name="birthday" blockfactor="100">
FROM tbl_personal, tbl_employees
WHERE tbl_employees.EmployeeID = tbl_personal.EmployeeID
AND (tbl_personal.Birthdate = ###TodayDate###)
ORDER BY tbl_employees.SortName asc
<!-- END QUERY SECTION -->
<CFIF #count# EQ 0>
There are no birthday celebrations on this day...