Question
how to display data on a regular basis
I have the following code and it works fine - but i want Cf
to pull fresh random data every 24 hours - any ideas?
<cfquery name="qArticles" datasource="#mxajaxdata#">
SELECT ID, Image, Blurb
FROM Articles
</cfquery>
<cfset ShownList = "">
<!--- Start the output --->
<cfoutput>
<!--- Loop until we have shown four entries --->
<cfloop condition="ListLen(ShownList) LTE 4">
<!--- Use RandRange to pick an article --->
<cfset ArticleToShow = RandRange(1, qArticles.RecordCount)>
<!--- If this article is not in the list of items shown --->
<cfif NOT ListContains(ShownList, ArticleToShow>
<!--- Add this article ID to the list of ones shown --->
<cfset ShownList = ListAppend(ShownList, ArticleToShow)>
<!--- Now display the output --->
<a href="articles.cfm?id=#qArticles.ID[ArticleToShow]#">
<img src="#qArticles.Image[ArticleToShow]#" border="1"></a>
#qArticles.Blurb[ArticleToShow]#
<br />
<hr />
</cfif>
</cfloop>
</cfoutput>
<cfquery name="qArticles" datasource="#mxajaxdata#">
SELECT ID, Image, Blurb
FROM Articles
</cfquery>
<cfset ShownList = "">
<!--- Start the output --->
<cfoutput>
<!--- Loop until we have shown four entries --->
<cfloop condition="ListLen(ShownList) LTE 4">
<!--- Use RandRange to pick an article --->
<cfset ArticleToShow = RandRange(1, qArticles.RecordCount)>
<!--- If this article is not in the list of items shown --->
<cfif NOT ListContains(ShownList, ArticleToShow>
<!--- Add this article ID to the list of ones shown --->
<cfset ShownList = ListAppend(ShownList, ArticleToShow)>
<!--- Now display the output --->
<a href="articles.cfm?id=#qArticles.ID[ArticleToShow]#">
<img src="#qArticles.Image[ArticleToShow]#" border="1"></a>
#qArticles.Blurb[ArticleToShow]#
<br />
<hr />
</cfif>
</cfloop>
</cfoutput>