Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

Is it possible to refresh page and show remainder of recodset?

I am using the below code to show 45 records in a dual column, the page will refresh every 30 secs.  how ever I would like it to show on the refresh the remainder of the records if they are GT 45 until it hits the final record then it can start again from 1-45?

any insight would be great.
(in case you want to know it will be for a message center that will display all messages received on a screen so people can come pick it up)



code is as follows:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh" content="30">
<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>
</head>

<body>
<cfset numberOfRecordsBeforeHeaderDisplay = 45>
<cfset pageBreakCounter = 0>


<cfset numberofrecords = "#get_mess.recordcount#">
<Cfset TotalPages =  numberofrecords/numberOfRecordsBeforeHeaderDisplay >

<cfset page =1>



<cfoutput query="get_mess">
<!--- Display header --->

<cfif get_mess.currentRow mod numberOfRecordsBeforeHeaderDisplay EQ 1>
 <cfif pageBreakCounter eq 0>
    <!-- start newspaper table -->

 
 
    <div align="center">
      <em><strong>MESSAGE CENTER</strong></em>
      </div>
    <table width="100%" cellpadding="0" cellspacing="0">
   
      <tr>
 </cfif>
 <cfset pageBreakCounter = IncrementValue(pageBreakCounter)>
  <td width="5%">
        <table width="100%" height="90%" cellpadding="0" cellspacing="0">
          <tr>
            <td width="81%" valign="top" align="left">Name</td>
           
           <td width="20">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          </tr>
          <td> </cfif>
          <!--- table cell display --->
          <tr> <font face="Arial, Helvetica, sans-serif" size="2">
            <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#</td>
           
         
            </font>
          <!--- Display close table --->
          <td> <cfif get_mess.currentRow mod numberOfRecordsBeforeHeaderDisplay EQ 0 OR get_mess.currentRow EQ get_mess.recordCount>
        </table>
  </td>
    <cfif pageBreakCounter mod 2 eq 0 OR get_mess.currentRow EQ get_mess.recordCount>
      <cfset pageBreakCounter = 0>
      <!--- close newspaper table --->
  </table>
      <br class="pageBreak">
        <cfset Page=Page+1>
    </cfif>
</cfif>
</cfoutput>

</body>
</html>
0
jriver12
Asked:
jriver12
  • 9
  • 6
  • 3
  • +1
1 Solution
 
James RodgersWeb Applications DeveloperCommented:

do query



<cfif isDefined("url.start")>
   <cfset iStartRow=#url.iStartRow#+50>
   <cfif iStartRow gt query.recordCount>
      <cfset iStartRow=1>
   </cfif>
<cfelse>
    <cfset iStartRow=1>
</cfif>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#iStartRow#">

<cfouptput query="" startrow="iStarRow" maxrows="50">
0
 
jriver12Author Commented:
the refresh portion works unfortunately I keeps returning the same record set.

<!--- get the messages --->
<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif isDefined("url.start")>
   <cfset iStartRow=#url.iStartRow#+45>
   <cfif iStartRow gt query.recordCount>
      <cfset iStartRow=1>
   </cfif>
<cfelse>
    <cfset iStartRow=1>
</cfif>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#iStartRow#">



<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
James RodgersWeb Applications DeveloperCommented:
do you have the met tag between cfoutput tags?

<cfoutput>
   <meta http-equiv="Refresh" content="30;URLpage.cfm?start=#iStartRow#">
</cfoutput>
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jriver12Author Commented:
this is what I have done with no luck.
<!--- get the messages --->
<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif isDefined("url.start")>
   <cfset iStartRow=#url.iStartRow#+5>
   <cfif iStartRow gt query.recordCount>
      <cfset iStartRow=1>
   </cfif>
<cfelse>
    <cfset iStartRow=1>
</cfif>
<cfoutput><meta http-equiv="Refresh" content="5;URLpage.cfm?start=#iStartRow#"><cfoutput>



<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="10"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>

0
 
James RodgersWeb Applications DeveloperCommented:
this line

<cfif iStartRow gt query.recordCount>

should be

<cfif iStartRow gt get_mess.recordCount>
 i put the query.recordcount as a spacer

ok try this

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#evaluate('#iStartRow#'+45)#">
</cfoutput>


<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
James RodgersWeb Applications DeveloperCommented:
left a line out


<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   <cfelse>
       <cfset iStartRow=#url.start#>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="30;URLpage.cfm?start=#evaluate('#iStartRow#'+45)#">
</cfoutput>


<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
jriver12Author Commented:
still receiving the same recordset.

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   <cfelse>
       <cfset iStartRow=#url.start#>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="5;URLpage.cfm?start=#evaluate('#iStartRow#'+10)#">
</cfoutput>


<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="10"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>


</table>
0
 
James RodgersWeb Applications DeveloperCommented:
sorry typo

try this as teh meta tag

<meta http-equiv="Refresh" content="30;url=URLpage.cfm?start=#evaluate('#iStartRow#'+45)#">
0
 
anandkpCommented:
I guess using CFFLUSH wld help here

read help on it & try it out !
0
 
hartCommented:
ok how about this

<cfparam default="1" name="iStartRow">

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif iStartRow gte get_mess.RecordCount>
  <cfset iStartRow = 1>
</cfif>

<HTML>
<HEAD>
<meta http-equiv="Refresh" content="30;url=pagename.cfm?iStartRow =<cfoutput>#evaluate(iStartRow+45)#</cfoutput>">
</HEAD>
<BODY>
<table>
<tr>
<td> Messages have been rececived for the following</td>
</tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="45"><tr>
<td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
</td>
</tr>
</cfoutput>
</table>
</BODY>
</HTML>


let me know

Regards
Hart
0
 
hartCommented:
there will be space in between iStartRow =<cfoutput>#
kindly remove it and make it to iStartRow=<cfoutput>#
in the meta tag

Regards
Hart
0
 
James RodgersWeb Applications DeveloperCommented:
here is the complete code bu tin the meta tag you really should have a value greater that 5, that value is the number of seconds until the page refreshes, go with 30 or at least 20

<cfquery name="get_mess" datasource="noticias">
Select * from news
</cfquery>

<cfif not isDefined("url.start")>
  <cfset iStartRow=1>
<cfelse>
   <cfif url.start gt get_mess.recordCount>
      <cfset iStartRow=1>
   <cfelse>
       <cfset iStartRow=#url.start#>
   </cfif>
</cfif>
<cfoutput>
<meta http-equiv="Refresh" content="5;url=URLpage.cfm?start=#evaluate('#iStartRow#'+10)#">
</cfoutput>

<table>
 <tr>
 <td> Messages have been rececived for the following</td>
 </tr>
<cfoutput query="get_mess" startrow="#iStartRow#" maxrows="10"><tr>
 <td width="81%" valign="top" align="left">#Message_for# Rec: #timeformat(message_date,"hh:mm tt")# #message_company#<br>
 </td>
</tr>
</cfoutput>

</table>
0
 
jriver12Author Commented:
Jester_48
Thanks for the insight on the meta time I had set it to 5 because I did not want to wait during testing.  However the last correction on the meta worked flawlessly. thanks for the assistance and time with this code.
0
 
jriver12Author Commented:
Thanks to all to have participated in this thread your assistance is and always will be greatly appreciated.

Thanks again.
0
 
James RodgersWeb Applications DeveloperCommented:
np...
glad i could help

i apologize for the typos, can't type worth a damn, kind of a bad thing for someone in my job

;-)
0
 
James RodgersWeb Applications DeveloperCommented:
thanks for the points
0
 
jriver12Author Commented:
I Feel You Pain.

And your welcome, would have offered more but EE limits me.

;^0
0
 
James RodgersWeb Applications DeveloperCommented:
>>would have offered more but EE limits me
thanks
but ,hey... no worries
0
 
hartCommented:
did u even try my post it was more simplified ???

Regards
Hart
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 6
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now