Payload9 Posted February 17, 2008 Share Posted February 17, 2008 Hi Everyone, I am a new member here, as well as new to the world of PHP. I have an O'Riley book on "learning PHP" and it has been good so far. What I have done so far is create a page that will parse out a unique URI and return it's contents to a MySQL database. I have set up three statements to run. The first statement says, if there's nothing in the MySQL database, then display "we didn't find anything so we populated the MySQL database". The MySQL database is then populated with the unique URI information. The second statement says, if this unique URI is present in the MySQL database, but the field "tcode" is NULL then display "we found this in the database already, but tcode is not populated". The third statment says, if this unique URI is present in the MySQL database, and the field "tcode" is not NULL then display "we found this in the database already, and tcode IS populated". All of those statements work, the problem is when I go to a different page, any page (like yahoo) then select the php URI from the browsers address bar that I have just used, the page does not reload. It simply uses the cached information from the browser, and I do not want this to happen. Keep in mind, if I press F5 or the "refresh" button, then the PHP code is re-processed. Or if I open up a new browser session and use the URI then the page is again, re-processed. It only does not re-process when the URI is used in the same browser session. Is there a way to make PHP re process the page every time a user hits the page? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Stooney Posted February 17, 2008 Share Posted February 17, 2008 As far as I know that has to be set client side in the browser. I had a similar problem with an AJAX script. Quote Link to comment Share on other sites More sharing options...
Payload9 Posted February 18, 2008 Author Share Posted February 18, 2008 Thanks for the reply. I thought this was probably a client side issue, but I wanted to try and make sure I wasn't assuming something that wasn't true. I found a couple of commands that seemed interesting like "ob_flush" and "flush". But I can't quite tell if these functions will do anything client side. Or force a browser to re-process the PHP code. Any thoughts? Quote Link to comment Share on other sites More sharing options...
uniflare Posted February 18, 2008 Share Posted February 18, 2008 you can use headers to try and prevent browsers from caching the page. this should work: <?php // Date in the past header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // always modified header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // HTTP/1.1 header("cache-Control: no-store, no-cache, must-revalidate"); header("cache-Control: post-check=0, pre-check=0", false); // HTTP/1.0 header("Pragma: no-cache"); ?> You can also stop search bots like google from caching your pages by adding this meta tag: <meta name="robots" content="noarchive"> ----- for more information see http://www.searchengineworld.com/r/redirect.cgi?f=21&d=10628&url=http://www.mnot.net/cache_docs/ Quote Link to comment Share on other sites More sharing options...
Payload9 Posted February 18, 2008 Author Share Posted February 18, 2008 Thanks Uniflare! I'll definitley give this a shot. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.