1

I have function in php, where I update a database. I have url something like http://localhost/products/feed/update

How can I update database every 15 minutes? It is better script or session or how to do this?

Pete
  • 57,112
  • 28
  • 117
  • 166
Juraj Lúdik
  • 83
  • 1
  • 7

2 Answers2

0

The best is a cron (or a scheduled task on windows).

The good question is also: do you really NEED the database to be updated every 15 minutes?

Can't you just check the last update timestamp upon request, and update it once for every 15 minutes that passed? That's often the simplest solution.

blue112
  • 52,634
  • 3
  • 45
  • 54
  • I dont know how to chcek it... start session? or what can start my php function in some time some timechec ajax function?(i know how to do it only on page load and function like this....) – Juraj Lúdik Aug 05 '15 at 08:27
0

Do you need it to be PHP script?

You could have stored procedure run by event every 15 mins.

For example in MySQL: https://dev.mysql.com/doc/refman/5.6/en/create-procedure.html https://dev.mysql.com/doc/refman/5.6/en/events.html