Forum Moderators: coopster
The problem I have is that I don't know how to save the report.
1. User chooses report option.
2. When Search clicked, PHP checks the URL string for the cache name.
3. If a static file with cache name exists the file is displayed in the pop up window
4. If the file does not exist the report is generated, displayed in the pop up window and saved as a static file.
<form....
javascript:popupreport"http://www.widgets.co.uk/php/search.php?report=widgets&cache_name=widgets12jan04")
search.php ...
if (file_exists($cache_name)) {
include($cache_name);
} else {
mysql search database...
display report..., save report...
}
I haven't tested this yet but I'm sure the include in the pop up window will work.
What' I'm not sure is the save report.
The display report just writes <html>...<table>... etc. so how do I get that page to save as the cache file name?
Because there can only be 10 reports each day, I can auto generate the files at midnight. There is then no need to generate the report on the fly because it had already been generated.
I can then just open the report in a popup window.
So all I need to do is to run the report in a php batch command line.
server>php search.php?report=widgets >widgets12jan04.html
This runs the database search and saves the outputted file to the cache_name.
But I can't do this on the server. It's Linux and it doesn't recognise / have the PHP executable?
Is there another way around this? I can set up a html page with the queeries all set on a page but that then would require a manual press of a submit button.
[edited by: Frank_Rizzo at 10:24 am (utc) on Jan. 13, 2004]