Page 1 of 1

Updating graphs in browser

Posted: Sun Apr 13, 2008 4:01 am
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!

Re: Updating graphs in browser

Posted: Sun Apr 13, 2008 9:48 am
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.

Re: Updating graphs in browser

Posted: Mon Apr 14, 2008 12:09 am
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.

Re: Updating graphs in browser

Posted: Mon Apr 14, 2008 2:25 am
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");

Re: Updating graphs in browser

Posted: Mon Apr 14, 2008 10:47 am
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!