Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bufferering or background task ? .. help !

    Hi all,

    I have a script that calls another one which has a loop that reads a huge file (mine actualy 14 Mb) and reads it line by line (actualy 55000), parses them and makes an INSERT in a MySQL database.
    The file can even be larger ...

    At start of script i display a short info and normaly each time an error is detected in a line, it should diplay a warning.
    At the end of script, i display the result : number of line inserted and number of errors.

    If everything works ok on small files (about several thousand of lines) i do have a problem on large files. The execution time (70-80 s) is beyond time out of server and browser. It also depends on what server it runs.
    In some configuration, nothing is displayed until end of script, with others the begining is displayed than nothing, sometimes it timeouts and nothing is done.

    How can i make the script run in background and/or display a progress bar or something that would warn the client that something happens ?

    I tried to send a == to the browser at x loops but that does not solve my problem. I tried to optimize evrything i could in parsing and MySQL command... (can't use LOAD DATA INFILE due to server restrictions)

    Every help is welcome.
    A happy new year to all readers.

  • #2
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you have access to the php.ini file? If so you could change the timeout setting.

    Also, why not diplay an image to the user while your page is doing it's thing?
    http://mentalized.net/activity-indicators/

    This might help as well....http://us3.php.net/flush


    Check out some ajax examples as I think they would work for you here.
    http://rajshekhar.net/blog/archives/...-Tutorial.html

  • #3
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for answer.

    I forgot to tell that i could not manage to make flush() work in my script, even if it should !! No way...

    I will have a look on AJAX page you gave me. It seems that AJAX is the future... I use it intensively every day ! But as a customer in GMAIL.

    Thanks for the nice pictures, i can use them but the problem is that my script is timing out if i do nothing !

    Patrick,

    Quote Originally Posted by Mithrilhall
    Do you have access to the php.ini file? If so you could change the timeout setting.

    Also, why not diplay an image to the user while your page is doing it's thing?
    http://mentalized.net/activity-indicators/

    This might help as well....http://us3.php.net/flush


    Check out some ajax examples as I think they would work for you here.
    http://rajshekhar.net/blog/archives/...-Tutorial.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •