views:

44

answers:

1

I have a PHP script that works by calling items from a database based upon the time they were placed in there and it deletes them if they are older than 5 minutes. Basically, I want to now simulate what would happen if this database was being updated regularly.

So I was considering sticking in some code that loads an XML file then goes through and parses that into the database based upon the time data located within a node of the xml data... but the problem there is I want it to continually loop through an enter this data so it'll never actually run the other processes

So I was thinking of having another PHP script do that that could do this independantly of the php script that is going to display this data...

In theory:

I am looking to have a button that I can press and it will then run some php code to load up an XML file from a directory on my web server and then iterate though the data sending the data, to a database, based upon the time within a node in the PHP script and when the script was first called

So back to my page that displayed the data... if I continually hit refresh it will contain different results each time because data is being added by the other process and this php script removes the older data when it is refreshed

Any information on this?

Is there a way I can silently, and safely, run a php script without it being loaded into a browser... like a thread!?

+1  A: 

Why not just run the PHP script that parses and inserts data into your DB from PHP's CLI?

http://www.php.net/manual/en/features.commandline.usage.php

mmattax
The problem I have is I need to demonstrate this at university and they won't have PHP installed so I was hoping to be able to do it on my web server so I can then visit index.php?simulate=true and it'd load up the simulator page so I could start the process of simulation.Then i'll be able to easily demonstrate my project within a web browser with no faffing about
Emdiesse
@Emdiesse make the script run as a cron job on the webserver. You can make the script only insert data when the DB is "running low" on data.
mmattax