January 5th, 2013, 08:22 PM
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' (
) 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.
<?php include ('majorindices.php') ; ?>
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.
January 5th, 2013, 09:34 PM
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.
January 5th, 2013, 09:46 PM
Good idea, never thought of that, thanks very much requinix
Originally Posted by requinix
January 6th, 2013, 06:56 PM
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!