NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] caching pages & debugger


Joined: 16 Jun 2006
Posts: 2
Reply with quote
I am writing a browse program which which list customers, 20/page. If the user enters the customers name, they can enter a complete name or they can enter minimal search criteria. For example, "c" . This will return a result set of 4880 customers when I execute sql "select name from customer where name like "c%" (244 pages)). I have implemented "Back" and "Next" buttons which execute javascript onClick="history.back()" and onClick="history.forward()" respectively so I am not always hitting the db when going forward. I keep track of the page I am on ($onPage), the number of pages I have viewed ($pagesViewed) and total pages ($totalPages). I do this so I know what "Next" button to put on the page. For example, if my $onPage==$pagesViewed. then my "Next" button must hit the db to get the next 20 customers. If my $onPage < $pagesViewed my "Next" button can execute "history.forward(), because I have already viewed the next page. In all cases, the "Back" button is "history.back()", except when $onPage==1.

I am having a little difficulty with my "Next" button. It is always going to the db, even when I do "Next" 10 times, then "Back" 5 times, and finally do "Next" 2 times. The "Next 2 times" should execute "history.forward(), but it is hitting the db.

While running my program in PHPeD, when I hit the "Back" button (history.back()), I get the following error message:

Warning: Page has Expired

The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

To resubmit your information and view this Web page, click the Refresh button.



Question: Is there a way I can configure PHPeD internal browser to save my web pages while in or not in debug mode when I hit the "Back" button?

Thanks much!
Marv
View user's profileFind all posts by marvins611Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 8340
Reply with quote
You're playing with browser cache and it's always a bit tricky.
When you pressed back and saw that the DB was not accessed, it means that the page was retrieved from the cache and your php script was not executed. It's not acceptable for the cases when you work with php debugger because otherwise you'll post there "why debugger does not work for me at all" Smile So debugger sends "no-cache" instruction to the browser.
I'd highly recommend you to stop using browser cache that way and if you care of the performance just switch to using http if-modified-since header (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). If your script got a request and realized that the data was not modified since it was sent last time upon the request with the same arguments, it will simply output HTTP/304 code. In this case browser will get the page from cache and it will be appropriate.
To see a complete example, just check php.net site sources:
http://www.php.net/source.php?url=/index.php
in particular see the line with header("HTTP/1.1 304 Not Modified")

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
[resolved] caching pages & debugger
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic