Its very simple just add a random GET
request in the header
method as follows:
header("Location: contact.php?dummy=")
will work fine, You can also pass random values to dummy=<some random value>
using random method for better performance...
Question
I got this problem with my site, where I got some values from a database, I show it in a table on a page, and from that page, you can change the values. But when I change the values, run the MySQL query that updates the fields, and use
header("Location: contact.php")
to go back to the page thats shows the values. But the values do not change to the new ones, before I press Ctrl+F5. Is there any way to prevent the site from storing the data, and showing fresh ones right away?
Solution
Its very simple just add a random GET
request in the header
method as follows:
header("Location: contact.php?dummy=")
will work fine, You can also pass random values to dummy=<some random value>
using random method for better performance...
OTHER TIPS
It does sound like you're encountering a caching issue, as @Anirban mentioned. However, if you don't actually want the results cached, it's probably better to prevent the caching in the first place, rather than to have the browser store a bunch of data it's not going to use. You can add these headers:
header('Cache-Control:no-cache, no-store, must-revalidate')
header('Pragma:no-cache')
header('Expires:0')
in your PHP code at the top of the contact.php
file.