Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordCount not counting records...

Status
Not open for further replies.

maverik59

Programmer
Oct 30, 2002
67
GB
I have an odd one or am i just doing something ridiculous.Seems simple enought when there are no records that person has posted from the past week i want it to say nothing to report (its for a "whatsnew" section). So i've done this and it won't have it. created_by is the unique id of us administrators..

<cfquery datasource=&quot;#Application.DB#&quot; name=&quot;newpknews&quot;>
Select * from news_items
WHERE news_items.created_date > curdate() - INTERVAL 7 DAY
AND created_by = 6
ORDER BY news_items.created_date
</cfquery>

<td class =&quot;newsheader&quot;>News from the past week...</td>
<tr><td>&nbsp;</td></tr>
<cfoutput query=&quot;newpknews&quot;>
<cfif Evaluate(#newpknews.RecordCount#) EQ 0>
Nothing to report
/********This bit here just won't work....******//

<cfelse>
</td></tr>
<tr><td class=&quot;newssubject&quot;><a href=&quot;news_article.cfm?ID=#news_id#&quot; class=&quot;newssubject&quot;>#news_subject#</a></td>
</tr>
<tr><td class=&quot;newsarticle&quot;>#news_data#</td>
</tr>
<cfif news_uselongdata>
<tr><td align=&quot;right&quot; class=&quot;newsnotes&quot;>Click <a href=&quot;news_article.cfm?ID=#news_id#&quot;>here </a>for details</td></tr>
</cfif>
<tr><td>&nbsp;</td></tr>
</cfif>
</cfoutput>

 
Two things:

<cfif Evaluate(#newpknews.RecordCount#) EQ 0>

can be written

<cfif newpknews.RecordCount EQ 0>

you don't need to use evaluate or the #'s

try using CFDUMP after your query to see if there is anything being returned by your query, like this:

<CFDUMP VAR=&quot;#newpknews#&quot;>

Hope this helps!

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top