Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I'm looking for some sort of a rout

Status
Not open for further replies.

jordanpope

Programmer
Sep 23, 2003
21
BR
I'm looking for some sort of a routine, using PHP or other, to display a message during PHP/MySQL processing ... something like:

Please be aware that for some reports their will be lengthy processing times.

I have a PHP application with a MySQL backend - the user can select parameters from which reports are generated, but some of the reports take between 1-2 minutes to process. Therefore I would like to display this message, and possibly some sort of a progress bar (that doesn't necessarily have to be synced to the actual processing progress). Then the message would be removed once the processing is complete and the report is presented.

Any ideas?
 
yes:
<?
echo &quot;<div name='outp'>Processing...</div>&quot;;
flush();
//Do SQL process here...
?>
//All other HTML
</html>
<script>
document.getElementByName(&quot;outp&quot;).innerText=&quot;&quot;
</script>

does it work?

Known is handfull, Unknown is worldfull
 
like i said in the JS forum try removing the <script> tag at the end and tell me what happens...

Known is handfull, Unknown is worldfull
 
This is tricky but there is a workaround that makes use of JavaScript in conjunction with PHP. A progress bar is not possible as there is no real streaming connection between the server and the browser. An animated gif file or something like that (ever been to Orbitz?) will do. The report will be written to a temporary file that you display after the progress page.

1. Write an html page that first outputs the entire page and that contains the text and image you select. In the HTML put an onLoad handler in the <body> tag. It is important to keep the HTML page relatively short so it really loads into the browser quickly.
2. The onLoad handler calls a JavaScript function that sets the page's location to the created report page you want to go to.

You would have to handle the temporary files with routines you write.

Doing both in one script is probably possible employing advanced DHTML techniques such as changing the visibility of layers. There could be a report layer, that is made visible upon page load and a processing.... layer that is initially invisible. You might want to consult with the JavaScript/DHTML forum to get more detailed info. PHP itself can only help here by outputting the code to the browser. This option is only recommended in an environment where you know that the browsers used are fully enabled for javascript and layers. Corporate Intranets and internal applications would allow you to do that.

One more thing. If you are expecting 2 minutes of executin time just double check that the maximum execution time limit is set to cover that. Otherwise the script execution will be aborted prematurely.
 
thanks DR ... this seems to be what I am looking for ... just one more question - whats the full address for orbitz (orbitz.com) appears to be an airfare site ...
 
Yes it is an airfare site. I just used the inbetween page as an example for some animated graphics that are untimed as such and disappear when the page redirects i.e. the results display. Search for airfaire and you'll see tha page.
You need not buy a ticket ... ;)
 
try this:
Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<?php 
echo &quot;<div id='outp'>Outputting...</div><script>status='Outputting!!!'</script>&quot;;
flush();
sleep(5);//ur mysql code here
?>
</body>
</html>
<script>
	document.getElementById('outp').innerHTML=&quot;&quot;
	status=&quot;Done&quot;
</script>

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top