Routine to validate if date is earlier than today, if changing the field status to full

Asked

Viewed 76 times

0

I need to do a routine to check if the end date of a particular event has passed, that is if the date of the "end" field is lower than today’s date update to the "state" field to "finished".

I’m working on codeigniter 3.0

Esta é a minah tabela

The sql code I know my problem is to have this code run every day for example at 00:00 every day it checked and changed the state. I still don’t have code developed from that routine because I don’t know how to do it anyway

  • Opa @Orannjamechanic, do you have any code you tried? It makes it easy for people to help you. Put an example of the field, date format and etc...

  • 1

    Would that be the idea: update eventos set status = 'finalizado' where end_date < now() ?

  • sql i know, the problem is how do I make it run this update every day? Thanks

  • Click [Edit] and enter relevant details of your question, such as the database you are using, the structure of your table and what you have developed of code so far.

  • 3

    @Orangemechanic then your question is different, and you already have the answer here.

  • @gmsantos Thanks, didn’t even know the name of the procedure to do research, thank you

  • even use cron if you have Cpanel will be easier to use

Show 2 more comments
No answers

Browser other questions tagged

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