#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Adelaide, South Australia
    Posts
    15
    Rep Power
    0

    Get page to keep loading whilst PHP script is loading


    I'm having an issue with a php script I've got running.

    Basically this script is grabbing share prices from a .csv and its rather slow...

    so on index.php I've got the php file 'included' (
    PHP Code:
    <?php include ('majorindices.php') ; ?>
    ) but the problem i've got is that when i load index.php it won't load any of the html after that include tag until majorindices.php has finished doing its thing....I've had a read around and someone suggested using flush() but I can't seem to get that to work either.

    I'm guessing I'm going to need some sort of ajax script? If anyone could help with suggestions i'd really appreciate it.


    Thanks in advance.
    Ben
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,294
    Rep Power
    9400
    Consider moving that stuff into a cronjob. Every once in a while, like a minute, some script runs which updates the prices in your database. It would run entirely behind the scenes without your regular code having to worry about it.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Adelaide, South Australia
    Posts
    15
    Rep Power
    0
    Originally Posted by requinix
    Consider moving that stuff into a cronjob. Every once in a while, like a minute, some script runs which updates the prices in your database. It would run entirely behind the scenes without your regular code having to worry about it.
    Good idea, never thought of that, thanks very much requinix
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0
    You may also want to consider using APC for caching and easily sharing such data across your scripts. Beats using a database or the file system any day as long as you aren't storing so much data that it would fill up your comps ram!

IMN logo majestic logo threadwatch logo seochat tools logo