[SOLVED] Cache Refresh Problem - Simple?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Subliminal
Forum Commoner
Posts: 40
Joined: Thu Oct 23, 2003 8:12 pm

[SOLVED] Cache Refresh Problem - Simple?

Post by Subliminal »

Hi Guys!

I have a bit of a problem on my hands...

I have a page that does a search for some items in MySQL and then prints the results.

Also on this page are buttons that the user can click. These buttons, among other things will insert information into the database to be printed when the page is loaded again (The First Step Mentioned Above)

The problems is whenever the user clicks the button and the page is processed (self processed) the items that appear from the MySQL search don't change unless you hit the reload button. After hitting the reload button the items that the user inserted to the database appear normally.

I have run into a similar problem in the past and was able to resolve it by adding:

Code: Select all

<?php
header('Pragma: no-cache'); 
header('Cache-Control: no-cache, must-revalidate');
?>
However this time that doesn't seem to work on this page

Thanks for your help...
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Have header() before any output starts in the browser.
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

header('Expires: 0');
may help too :)
Subliminal
Forum Commoner
Posts: 40
Joined: Thu Oct 23, 2003 8:12 pm

Post by Subliminal »

Hey Guys,

Thanks but neither of those seem to work

I placed them at the very top of the page.
Goes something like this...

headers
some html containing the buttons to add things
the query and results
if isset that inputs the user results


GRRRRRRR I just realized my problem - I am calling the query first and then the input .... SIGH!!!!!!!!!!!!!

THANKS!
Post Reply