about refreshing page

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
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

about refreshing page

Post by bugthefixer »

i have once posted this topic before but i could not fix my problem. my problem is when i click o a link for the first time then it doesnt cause any problem but when i click for the second time it gives me the page without refreshing it same as i click on it for the first time but when i click it for the third time then it gives me refreshed page.
my page actually show databae contents so during my first and second click if i chenge my databse it shows me previous records but if i click for the third time then it gives updated record.
anybody can tell me how can i resolve this issue.
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

sounds to me like a caching problem

try this code in the <head></head> of your page

Code: Select all

<META HTTP-EQUIV="Cache-Control" CONTENT ="no-cache">
or for netscape

Code: Select all

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
Hope im on the right track.

Good Luck
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

well i did as you directed i mean i added

<META HTTP-EQUIV="Cache-Control" CONTENT ="no-cache">

but it didnt work.. is there any other idea
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

add

Post by fresh »

a refresh to the page after the script parses like so:

Code: Select all

<?php
some stuff

echo "<script>window.reload(true)</script>";
?>
something like that... hope this helps :)
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Add this in the FIRST line of your page :

Code: Select all

<?php 
header("Cache-Control: no-store, no-cache, must-revalidate"); 
?>
Post Reply