mb Posted January 25, 2011 Share Posted January 25, 2011 I have an issue with refreshing pages on the website. I have a simple code using php to login to the website fill in a form and exit. The code works fine and adds the enterd data correctly in the table in MySql. I have another link where the user can retrieve the recods to update any fields after logging in. The problem I encountered was that the retreving records page does not show the newly added records until the page is refreshed on the server. Whenever the new record does not show, I just open the php code page save without making any changes to the code (just to enforce new time stamp), upload the page to the server only when I do that the new record shows. I would appreciate any help to solve this problem and not having to upload the page to get it to work. Thanks, MB Quote Link to comment https://forums.phpfreaks.com/topic/225593-page-refresh-issue/ Share on other sites More sharing options...
Simon Mayer Posted January 25, 2011 Share Posted January 25, 2011 The problem I encountered was that the retreving records page does not show the newly added records until the page is refreshed on the server. Whenever the new record does not show, I just open the php code page save without making any changes to the code (just to enforce new time stamp), upload the page to the server only when I do that the new record shows. That sounds like your browser is caching the results. The new timestamp maybe allowing another download. What happens if you load the page in the browser with a different GET value each time? e.g. yourlink.com/index.php?stopcache=1 yourlink.com/index.php?stopcache=2 , etc In theory that should prevent caching, as each load has a unique URL. It's a primitive method, but suitable for testing purposes. Quote Link to comment https://forums.phpfreaks.com/topic/225593-page-refresh-issue/#findComment-1164890 Share on other sites More sharing options...
mb Posted January 25, 2011 Author Share Posted January 25, 2011 Thank you Simon for the reply! It worked when I used a random # in the GET value! It seems to me that it is a caching issue with the host company as clearing my browser cache and history was not helping. In addition the problem was there even when testing on other computers. Is there a way to enforce caching on the server? Thanks, MB Quote Link to comment https://forums.phpfreaks.com/topic/225593-page-refresh-issue/#findComment-1165015 Share on other sites More sharing options...
blew Posted January 25, 2011 Share Posted January 25, 2011 try putting this on the code, after the query executed die("<meta http-equiv="refresh" content="0;url=SITE_URL_TO_REFRESH.php>"); it should work Quote Link to comment https://forums.phpfreaks.com/topic/225593-page-refresh-issue/#findComment-1165020 Share on other sites More sharing options...
BlueSkyIS Posted January 25, 2011 Share Posted January 25, 2011 DO NOT rely on meta tags to send the user to a new URL. Besides, that doesn't solve the problem at hand: caching. You could try sending additional header() info to prevent caching. Here is some info, though not tested (by me): http://www.blog.highub.com/php/php-solutions/php-prevent-browser-and-proxy-cache/ OR you could keep the random GET value in the URL to Quote Link to comment https://forums.phpfreaks.com/topic/225593-page-refresh-issue/#findComment-1165033 Share on other sites More sharing options...
mb Posted January 25, 2011 Author Share Posted January 25, 2011 Thanks! That was a good article! The additional header() helped! Thank you all for helping! Quote Link to comment https://forums.phpfreaks.com/topic/225593-page-refresh-issue/#findComment-1165069 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.