473,785 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Browser cache causing problem viewing php generated dynamic data

2 New Member
I have a PHP 4.4.7, MySql 5.0 and I.E. 7. My PHP queries the database and renders the info into html forms. Submitting the forms manipulates the data.

Now, the problem is that the browsers are caching the dynamic pages. Once the data is updated, returning to the original viewing page shows the old data until you hit refresh.

I know I can have my users adjust their internet file settings to "Check for newer versions of stored pages" to stop this behavior. I don't want to have to rely on users to make browser setting changes. They are challenged enough as it is.

Is there a way I can force the browsers to refresh at each viewing?

I've already tried placing an outdated meta tag in the headers to make the browser think the pages are too old:
Expand|Select|Wrap|Line Numbers
  1. <meta http-equiv="EXPIRES" CONTENT="TUES, 31 DEC 1996 12:00:00 GMT"> 
That doesn't seem to work.

Tom
Apr 23 '08 #1
3 1991
drhowarddrfine
7,435 Recognized Expert Expert
Browsers don't pay much attention to that anymore. The best method is setting it in the http headers. I don't know how to do that in PHP.
Apr 23 '08 #2
Tom
2 New Member
I found it after much gnashing of teeth and many google searches. It was right in php.net. I guess I just wasn't searching with the right phrases. And I apologize that this is really a PHP issue and not an HTML question.

To manually force PHP web pages to refresh when visited because of dynamic content, you can use the header function:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  3. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  4. ?>
There are a number of restrictions about the command's location in your script. You can read more at php.net
Apr 23 '08 #3
gits
5,390 Recognized Expert Moderator Expert
you could even use a unique additional querystring for the url that is requested ... so instead of requesting:

Expand|Select|Wrap|Line Numbers
  1. foo.php
just request:

Expand|Select|Wrap|Line Numbers
  1. foo.php?my_key=unique_value
where unique-value could be a timestamp added by javascript for example.

kind regards
Apr 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
6629
by: Ralph Freshour | last post by:
Is it possible to inhibit the browser Back/Fwd buttons via PHP? Thanks...
21
3267
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" http://www.tonymarston.co.uk/php-mysql/backbuttonblues.html -- Tony Marston http://www.tonymarston.net
2
3238
by: Ben | last post by:
Hi all, I have written a web server that listens for requests: class MyHandler(BaseHTTPRequestHandler): def do_GET(self): if (self.path)=='/': data=makeList() else:
2
474
by: Peter Row | last post by:
Hi, I have a site were the pages are dynamically generated on demand. These pages like any static html page may contain image tags and references to CSS files. All the images and CSS files etc... are stored in a database so in the HTML produced for the page the source of an image, for example, might be: src=http://www.mysite.com/Res/3/logo.gif
1
1575
by: Denise | last post by:
In my application, I am setting cookies used for other pages based on the current row selected. But when the user presses the 'back' button, the pageload event does not get called and the record they are viewing does not match the cookie and can lead to data entry errors. Is there a way to resolve this? Thanks, Denise
3
2769
by: PaulR | last post by:
Hi, I am trying to understand what invalidates Dynamic Packages in the Package Cache. By monitoring the Size of the Package Cache, it appears the following does 1. Performing a Runstats on all Tables reduces the Used Package Cache from some 200+MB to about 30MB ??
21
2328
by: nsimeonov | last post by:
Hello, Does anyone have any idea how Gmail does this? I have a web application and people complain sometimes about some problems and most of the time it turns out it's the browser's cache being full. The application doesn't do anything really fancy and all it does is to set a cookie. I did a search and couldn't find anything except people explainin how I shouldn't do that. Even if the users have to add the server to the trusted zone...
1
1874
by: emer.kurbegovic | last post by:
Is it possible to cache dynamic images in client's browser the same way static images are cached? for example, i'd like to be able to cache this dynamic image: <img src=pic.axd?id=2the same way the browser would cache it if it would say <img src=http://someplace.com/pic.jpg> is this possible? if not, what are my choices/alternatives? thanks in advance,
1
2487
by: Randy | last post by:
I have an application with a datagrid and a button to export the grid to excel. For the most part this is working fine. Here's the export method: Private Sub btnExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExcel.Click Try Response.Clear() Response.Buffer = True Response.ContentType = "application/vnd.ms-excel"
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.