473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Generated file

Hello,

I am 99% sure that the problem I am having is not PHP related, but to
remove my doubt, I am posting here.

I have a search page (interfacing with MySql) that displays results in an
IFRAME on the search page. I did this so the whole page would not have to
be reloaded on each query.

Each time I query the DB, I write the result set to a file and include this
file as javascript source on the results page. Up to this point everything
works fine, which is why I say I don't think this is PHP related.

I use javascript to "walk" the recordset. In internet explorer (only), the
first query recordset is all that is ever seen by the search page, even
though the javascript source file is correctly generated. Maybe this is a
little opaque so I will give an example.

search.html
--
<IFRAME NAME="dataiframe" SRC="blank.html"></IFRAME>
[...]
<FORM ACTION="display.php" METHOD="post" TARGET="dataiframe">
<INPUT TYPE="submit">
</FORM>

display.php
--
session_start ();
$filename = "tmp/" . session_id () . ".js";

// write recordset...
// include here
echo "<SCRIPT TYPE=\"text/javascript\" SRC=\"$filename\">

--
This file is always generated correctly. The problem arises when the
browser (IE) does not use the updated values in $filename. It is my belief
that IE caches the values in this file and when the frame is reloaded, IE
tries to be "smart" and sees that I am including the same file, and
therefore does not reload from the file but from its cache.

Now that I think about it, since the file is being correctly generated,
this is 100% NOT PHP related. Could someone shed light on this anyway? It
would be much appreciated.

Thanks,
Andrew
Nov 27 '05 #1
2 1498
*** Andrew Clark escribió/wrote (Sun, 27 Nov 2005 18:36:37 +0000):
It is my belief
that IE caches the values in this file and when the frame is reloaded, IE
tries to be "smart" and sees that I am including the same file, and
therefore does not reload from the file but from its cache.


I don't whether IE obeys date headers but you can tag the script document so it expires inmediately:

header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . ' GMT');
// HTTP/1.1
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);

// HTTP/1.0
header('Pragma: no-cache');
BTW, have you remembered to set the appropriate Content-Type header?

--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Nov 27 '05 #2
Besides the comments of Alvaro on cacheing, you can see some additional
comments at http://php.net/imagecreatefrompng.

Another technique some people use (which I don't recommend for
production, but may be OK for testing) is to append a dummy query
string to the end of the main page with a random component: "?rubbish="
+ randomNumber(). This ensures that the page is not cached.

Csaba Gabor from Vienna

Andrew Clark wrote:
Hello,

I am 99% sure that the problem I am having is not PHP related, but to
remove my doubt, I am posting here.

I have a search page (interfacing with MySql) that displays results in an
IFRAME on the search page. I did this so the whole page would not have to
be reloaded on each query.

Each time I query the DB, I write the result set to a file and include this
file as javascript source on the results page. Up to this point everything
works fine, which is why I say I don't think this is PHP related.

I use javascript to "walk" the recordset. In internet explorer (only), the
first query recordset is all that is ever seen by the search page, even
though the javascript source file is correctly generated. Maybe this is a
little opaque so I will give an example.

search.html
--
<IFRAME NAME="dataiframe" SRC="blank.html"></IFRAME>
[...]
<FORM ACTION="display.php" METHOD="post" TARGET="dataiframe">
<INPUT TYPE="submit">
</FORM>

display.php
--
session_start ();
$filename = "tmp/" . session_id () . ".js";

// write recordset...
// include here
echo "<SCRIPT TYPE=\"text/javascript\" SRC=\"$filename\">

--
This file is always generated correctly. The problem arises when the
browser (IE) does not use the updated values in $filename. It is my belief
that IE caches the values in this file and when the frame is reloaded, IE
tries to be "smart" and sees that I am including the same file, and
therefore does not reload from the file but from its cache.

Now that I think about it, since the file is being correctly generated,
this is 100% NOT PHP related. Could someone shed light on this anyway? It
would be much appreciated.

Thanks,
Andrew


Nov 28 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Irmen de Jong | last post by:
Hello, I don't understand why the following doesn't work. What I want to do is dynamically import some generated Python code and I'm doing this using compile and exec'ing it in the dict of a new...
1
by: Reader | last post by:
Hello, I would like to know if there is a way to cache the xmlserializer-generated temp files and have the program reuse these cached files upon new application instances. For example,...
6
by: Alan Krueger | last post by:
Is there a way to automatically include C# files (.cs) generated by a third-party tool into a Visual C# .NET build? It's possible the set of files generated by this tool might change. Adding...
1
by: Peter McEvoy | last post by:
Hi all, another question related to Schema and WSDL... I'd like to have a bit more control over the WSDL that is generated for my ..asmx. In particular, I'd like to override the generated WSDL...
27
by: ted benedict | last post by:
hi everybody, i hope this is the right place to discuss this weird behaviour. i am getting dynamically generated text or xml from the server side using xmlhttprequest. if the server side data is...
4
by: Fabio | last post by:
An ASP.NET 2.0 web site contains a web form and a web service. The web form consumes the web service. There is a Book class in the App_Code folder. The web service exposes a method that returns a...
1
by: robc | last post by:
Hi, I am using the xsd.exe tool (in .NET 2.0) to generate C# classes from a set of schemas. Some of the XML types that I have defined are used by more than one schema. For maintenance...
8
by: Les Caudle | last post by:
Using this command line to run XSD.exe xsd /c /o:outputDir input.xsd /f on the following XSD <?xml version="1.0"?> <schema xmlns="http://www.w3.org/2001/XMLSchema"...
12
by: webinfinite | last post by:
I am starting a new thread for this topic since previous problem has been solved. I have code like this: #include <stdio.h> int main(){
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.