Jump to content


Photo

Dinamicaly generated webh page with php images


  • Please log in to reply
2 replies to this topic

#1 taps128

taps128
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 15 May 2006 - 08:35 AM

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 15 May 2006 - 09:07 AM

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:
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");
That code should stop the browser from cacheing your images.

#3 taps128

taps128
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 15 May 2006 - 10:06 AM

[!--quoteo(post=373958:date=May 15 2006, 09:07 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 15 2006, 09:07 AM) View Post[/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:
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");
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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users