Re: Stop process when user close window browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On the other hand, you can tell the web server that the browser has been closed or the page has 'exited'.  Not 100% reliable, but in theory you could use the "onUnload" (think that was it) event for a web page  <body onunload="dosomejavascript();"> that does something sloppy like spawn a popup window that hits a PHP script that then checks MySQL processes or something.

Not a great solution, but if you really need some kind of feedback to the server if someone leaves a page, that may be one way to do it.


Also, another thing to think about, don't confuse an active query and an active database connection.   What you may be seeing is just the database connection still active.  You can use the database query "show processlist" to see if the connection is just open or there's actually a query still running.

-TG

= = = Original message = = =

weetat wrote:
> Hi Thomas,
> 
>   Yes. I read the manual regarding the connection handling.
>   However ,in my php program , the execution did not stop , because i 
> have logger which log sql statement "INSERT" statement when inserted 
> data to database is ok .
> 
> When i close the browser , the sql execution still running, statement is 
> logged.
> 
> Any idea how to stop it ? Because it cause my web page to be slow.

PHP doesn't know the browser has gone away until it tries to write 
something to it.  So if you are inside a long-running SQL-query and the 
browser drops, nothing will happen until the query call returns and you 
try to write something.

-Rasmus


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux