Hello everybody, I have got a question. I have a script in php and I want to execute something at a fixed time in the future, not by cron server. Let me explain more. I would create a car in a game, but for this I have to wait around 10 minutes. Ok, now I used time() and I set it up like this: time()+600. I am testing if time() is equal or greater than that time stored in database. If I do like this I have to refresh the page after 10 minutes to add the car. I don't want to do this anymore, I want to do it automatically after 10 minutes. What should I use for this? Thanks, Daniel Rosca
Cron is by far the preferred way, just run a script every x often, which then runs the required queries, really not that hard. Thinking of some alternatives could be... (wouldn't recommend.) /* At top of script */ ob_implicit_flush(true); ignore_user_abort(); set_time_limit(0); /** Script here **/ /* At end */ sleep(600); do_query($query); exit(); // Could probably remove this, depends on your script. PHP: Still, I wouldn't recommend it, but there's no reason why it shouldn't work.
if you want to refresh the page after 10 minutes then use this html inside php add this code in u r php file in header! <?php echo "<meta http-equiv=\"refresh\" content=\"600\" />"; //600 for 10 minutes ?> PHP: