How to update a database without action from the client?

2

I'm not very advanced in php, sql and everything else, and I came up with the following doubt. Assuming that today is day 10 and I want that if it happens on day 12 an information in the BD is updated to 'sent' for example, if the user is open has no difficulty, but if no user enters the site until day 20 for example, how do I do that when the day arrives, the server itself does this update?

    
asked by anonymous 06.04.2018 / 23:05

2 answers

3

What you will need is to create a script, for example in PHP, that runs the business rules you need, and schedule this task in a Cron Job system.

Cron Job is a type of Task Scheduler, where you will define the periodicity and which routine should be executed in this period.

Then you can set up for example for this PHP routine to be called every 1 minute, thus doing an independent processing of user access.

There are a number of Cron Job clients, including built-in hosting, Linux and Unix systems.

    
06.04.2018 / 23:10
0

One option would be to save that date in a database column and when it is necessary to know whether or not it has passed two days, just check with a WHERE clause, for example:

SELECT * FROM tabela WHERE NOW() > '$data';
    
07.04.2018 / 02:31