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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move to next record in query after 60 seconds

Status
Not open for further replies.

kryptor

Programmer
Sep 19, 2004
65
GB
Hi all,

I have a page setup that pulls my data using a query.

I want to be able to move the data to the next query result after 60 seconds. Once the query reaches the end then I want the page to refresh and all the query again so it is continuosuly pulling any nw data that has been entered into the database.

If there is anyone out there who could suggest a place to find an example similar to this or even has already made something then I would be eternally happy if you could share it with m.

Thanks in antiticipation.
Dave

If at 1st you don't succeed then I guess your i the right place to ask why! :p
 
There a few ways of doing this. One will be meta refresh. Take a look at this code.

Code:
<cfparam name="start" default="1"> 
<cfparam name="next"  default="0">
<cfparam name="wait"  default="5">

<cfset start = next + 1> 

<cfquery name="data" datasource="cfartgallery">
  SELECT  *
  FROM art
  where artID = #start#
  and artID < 5
  ORDER BY artID
</cfquery>

<cfif not data.recordCount>
	<cfset next = 0>
    <cfset start = next + 1> 
</cfif>
<cfoutput>
<meta HTTP-EQUIV="refresh" content="#wait#;URL=http://localhost:8500/#cgi.script_name#?next=#start#&wait=#wait#">
#now()#<br/>
</cfoutput>

<cfdump var="#variables#">

ColdFusion Ninja for hire.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top