Updating graphs in browser

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
dxv44
Forum Newbie
Posts: 3
Joined: Sun Apr 13, 2008 3:51 am

Updating graphs in browser

Post by dxv44 »

Hi, my graphs won't update immediately upon changing the data in the database. When I reload the graph page using the reload button from the browser, the graphs get updated, but not when I navigate to the graph page from elsewhere in the site. There must be a way of making the graphs more responsive. (I should mention I'm a relative newbie in PHP.) Any suggestion is greatly appreciated!! :)

Thanks!
jaydrawmer
Forum Newbie
Posts: 2
Joined: Sun Apr 13, 2008 9:41 am

Re: Updating graphs in browser

Post by jaydrawmer »

surely this is a problem with the browser? (as in temporary internet files). Most settings are default to updating automatically, but you can change them to update every time the page is loaded, and other such settings which should act as if the page is being reloaded everytime.
dxv44
Forum Newbie
Posts: 3
Joined: Sun Apr 13, 2008 3:51 am

Re: Updating graphs in browser

Post by dxv44 »

jaydrawmer wrote:surely this is a problem with the browser? (as in temporary internet files). Most settings are default to updating automatically, but you can change them to update every time the page is loaded, and other such settings which should act as if the page is being reloaded everytime.
Hi, jaydrawmer, I didn't consider the browser settings, thanks for the suggestion! I'll look into it.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Updating graphs in browser

Post by onion2k »

Fixing this problem by changing the browser settings will only fix it for you. Everyone else will continue to see the problem.

It's a caching problem. Look at adding headers that tell the browser not to cache the image eg

Code: Select all

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Tue, 01 Jan 2008 01:00:00 GMT");
dxv44
Forum Newbie
Posts: 3
Joined: Sun Apr 13, 2008 3:51 am

Re: Updating graphs in browser

Post by dxv44 »

onion2k wrote:Fixing this problem by changing the browser settings will only fix it for you. Everyone else will continue to see the problem.

It's a caching problem. Look at adding headers that tell the browser not to cache the image eg

Code: Select all

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Tue, 01 Jan 2008 01:00:00 GMT");
Thanks, onion2k, I think this is closer to what I was looking for!
Post Reply