Jump to content

Recommended Posts

I'm building a web based database application, and now I'm working on the statistical module. The module
takes a series of queries (begging and end date, workshop id), and generates a table countaing the number of each product produced in the given time frame, and a php image showing a graph representation of the table.
The image is created via php, and showed on the page via img src="....graph.php". It all works fine, but
when I insert a new query the table is generated fine, but the image shows old data. I hit refresh and then the image shows the data from the new query, which is impossible because I use sessions to transmit variables, and the session is destroyed at the end of the module.
at first i tpught it was my programming mistake(which it may yet be), then I tought it was my old php version(I upgraded to the current one ) but it was not... any one had a similar problem?
My current theory is that its about in the way how the browser/server loads images/scripts.
The server is most probably cacheing your mysql queries and/or your browser is cacheing your images.

So you might want to put [a href=\"http://uk2.php.net/manual/en/function.mysql-free-result.php\" target=\"_blank\"]mysql_free_result[/a] after have got the data from the database and put the following at the top of the PHP scripts that generates your images:
[code]header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");[/code]
That code should stop the browser from cacheing your images.
[!--quoteo(post=373958:date=May 15 2006, 09:07 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 15 2006, 09:07 AM) [snapback]373958[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The server is most probably cacheing your mysql queries and/or your browser is cacheing your images.

So you might want to put [a href=\"http://uk2.php.net/manual/en/function.mysql-free-result.php\" target=\"_blank\"]mysql_free_result[/a] after have got the data from the database and put the following at the top of the PHP scripts that generates your images:
[code]header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");[/code]
That code should stop the browser from cacheing your images.
[/quote]

well, it din't work but thanx for the input its very appriciated.. I'l countinue trying down this road
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.