Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    Cape Town, South Africa
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to force a page to fetch most recent data?

    Is it possible to force a page to fetch the most recent data from MySql rather than relying on a cached copy?

    I have a problem that when the user updates the database and then returns to the page which shows the user the information just updated, the page is not reflecting the most recent changes. Only once the page has been refreshed will it show the most recent changes.

    Is there anyway to force the page to "refresh itself" everytime it is accessed.

    Any help will be greatly appreciated!

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This has nothing to do with MySQL, since the caching is done by the browser. Usually the user sets how often and when cached pages shall be returned.

    You should be able to force the browser to reload the page if you redirect to the URL appended with a random value as a query string (try it with the current timestamp). When comparing yourFile.php?bla=123456789 with yourFile.php the browser sees a difference and tries to load the page anew.

    Hope that helps.

  • #3
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    You could try adding the following between your <head></head> tags

    Code:
    <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •