Even if you could get it to work, you'd be in trouble, as the PHP
interpreter will clean up after you and trash your MySQL connection when it
finishes, and anything that didn't get done before that would not work.

You'll probably need to code this with two separate PHP files, one which
calls the other using exec("/path/to/long.php &", $results, $errorcode);

Open the connection and do all the database stuff in long.php.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Jeff Bearer <[EMAIL PROTECTED]>
Newsgroups: php.general
To: PHP-General <[EMAIL PROTECTED]>
Sent: Wednesday, August 08, 2001 4:33 PM
Subject: register_shutdown_function and a MySQL query keeping connection
with browser.


> I've been working with register_shutdown_function() to have the browser
kick of a
> long running script and move on to other tasks.  I was having problems
where the browser
> would sit and spin untill the function was done running, then would
display the page.
> I tinkered with flush and fflush (i'm writing to a file also) but that
didn't work either.
> Flush showed me the screen, but the browser still keeps the connection
open untill
> the function was done running.  It seems to be caused by the mysql query
or result and the
> loop of the result set.  Below is some of the test script I put together.
I'm using the
> PEAR DB_mysql class.  I'm using the sleep where the part of the real
script takes some time
> to run.
>
> Has anyone dealt with this before, does anyone have any ideas? The only
idea I've thougt of
> so far is to load the record set into a 2D array and then flush the result
set.  That might
> allow the browser to disconnect before the time comsuming job starts.
>
> Any suggestions will be appriciated.
>
>
>
>
> <?php
> include "DB/mysql.php";
> $db=new DB_mysql;
> $db->connect($dsn);
>
> echo "hello";
> register_shutdown_function("tester");
> exit;
>
> function tester(){
>   global $db;
>   $sql="SELECT * FROM table";
>   $result = $db->query($sql);
>   while($row = $result->fetchRow(2)){
>      sleep(5);
>   }
> }
> ?>
>
>
>
>
> --
> Jeff Bearer, RHCE
> Webmaster
> PittsburghLIVE.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to