Scheduled tasks in PHP

Asked

Viewed 147 times

2

I have a database with information about books and loans of the same, when the time the book can be borrowed expires then the system must change the status of the loan record. I thought to do this as a programmed task, there is some way to accomplish this task using only PHP (no scheduled windows tasks or equivalent in linux)?

  • Which database?

  • I am using Mysql

1 answer

6


You can create events in Mysql itself, you need to enable the option event_scheduler=1 in the 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 ...;
  • 1

    Very GOOD! I will favorite.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.