Re: help in implementing a progress bar

From: Date: Mon, 11 Jan 2010 15:17:05 +0000
Subject: Re: help in implementing a progress bar
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-46772@lists.php.net to get a copy of this message
On Jan 7, 2010, at 2:36 PM, Vinay Kannan wrote: > Hello, > > Theres this project that I am working on, and a specific module does take > few secs to process, I am thinking it would be cool to be showing a progress > bar(some kind on a .gif image) while the script runs, does any one have an > idea how to implement this? > > Thanks, > Vinay K This isn't really database related, but ok... <?php // Progress.php class Progress { public function start () { echo file_get_contents ('progress.html'); flush (); } public function end ($url) { $text = "<script type=\"text/javascript\">"; $text .= "window.location = '$url';"; $text .= "</script>"; echo $text; flush (); } } ?> <?php // process.php - process the stuff $progress = new Progress(); $progress->start(); // ... Do your processing here ... $progress->end('nextpage.php'); ?> In the progress.html file, it would just be an html page that has an animated gif (and whatever else you want on it). Hope this helps. ~Philip

« previous php.db (#46772) next »