Scheduled Tasks in PHP

2

I have a database with information about books and loans from them, when the time that the book can be borrowed then the system should change the status of the loan record. I thought of doing this as a scheduled task, is there any way I can accomplish this task using only PHP (without scheduled windows tasks or linux equivalent)?

    
asked by anonymous 16.05.2017 / 20:36

1 answer

6

You can create events in MySQL itself, so you will need to enable the event_scheduler=1 option in My.ini , example:

/*Executa de hora em hora*/
CREATE EVENT e_hourly_book
ON SCHEDULE
  EVERY 1 HOUR
COMMENT 'Altera o Status dos livros'
DO
  UPDATE livro SET ...;
    
16.05.2017 / 20:47