Jump to content

Archived

This topic is now archived and is closed to further replies.

taps128

Dinamicaly generated webh page with php images

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites

×

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.