taps128 Posted May 15, 2006 Share Posted May 15, 2006 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, butwhen 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. Quote Link to comment https://forums.phpfreaks.com/topic/9696-dinamicaly-generated-webh-page-with-php-images/ Share on other sites More sharing options...
wildteen88 Posted May 15, 2006 Share Posted May 15, 2006 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 Link to comment https://forums.phpfreaks.com/topic/9696-dinamicaly-generated-webh-page-with-php-images/#findComment-35918 Share on other sites More sharing options...
taps128 Posted May 15, 2006 Author Share Posted May 15, 2006 [!--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 Quote Link to comment https://forums.phpfreaks.com/topic/9696-dinamicaly-generated-webh-page-with-php-images/#findComment-35924 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.