List:General Discussion« Previous MessageNext Message »
From:Carsten Pedersen Date:April 16 2010 12:01pm
Subject:Re: What if the user closes the browser while INSERT INTO
MySQL? (PHP/MySQL)
View as plain text  
http://php.net/manual/en/function.ignore-user-abort.php

/ Carsten

On Fri, 16 Apr 2010 18:39:07 +0900, Antonio PHP <php.antonio@stripped>
wrote:
> This maybe a newbie question.
> 
> Consider the following concept,
> 
> ~/index.php
> 
> #1. Fetch data from an external webpage using PHP Curl;
> #2. Preg_match/Prepare Data to INSERT from local MySQL; - this may take
a
> few secs
> #3. While Loop { INSERT data (from #2) into local MySQL } - this may
take
> only mili secs.
> 
> Suppose this code is run by a random user (say, my website visitor), and
> he/she closes the browser while the code was running. The real problem
is
> when the browser is closed while #3 is executing. Because only portion
of
> data is inserted, ~/index.php, and it doesn't know if it needs to visit
the
> site again (i.e. repeat from #1 -> over visiting the same webpage /
> possibility of inaccurate data in local MySQL).
> 
> Has anyone come across with a similar problem? Do I need to use other
> programming languages like C to execute the code from #2 in order not
> to depend upon users' browser status?
> 
> Another general question : Is there a way to make sure all the data is
> INSERTED in a while loop once it's triggered?
> 
> many thanks in advance,
> 
> - Anton
> 
> 
> !DSPAM:451,4bc835a5518712071889376!
Thread
What if the user closes the browser while INSERT INTO MySQL? (PHP/MySQL)Antonio PHP16 Apr
  • Re: What if the user closes the browser while INSERT INTO MySQL? (PHP/MySQL)Jørn Dahl-Stamnes16 Apr
    • Re: What if the user closes the browser while INSERT INTO MySQL? (PHP/MySQL)Geert-Jan Brits16 Apr
    • Re: What if the user closes the browser while INSERT INTOMySQL? (PHP/MySQL)Carsten Pedersen16 Apr
      • Re: What if the user closes the browser while INSERT INTO MySQL? (PHP/MySQL)Antonio PHP17 Apr
    • Re: What if the user closes the browser while INSERT INTO MySQL?(PHP/MySQL)Nigel Wood19 Apr
      • Re: What if the user closes the browser while INSERT INTO MySQL? (PHP/MySQL)Johan De Meersman19 Apr
        • Re: What if the user closes the browser while INSERT INTO MySQL? (PHP/MySQL)Michael Dykman19 Apr
  • Re: What if the user closes the browser while INSERT INTOMySQL? (PHP/MySQL)Carsten Pedersen16 Apr