Help with query creation task schedule

0

Galera,

I am making a script to trigger a message according to the record recorded in the database. It's like a CRON task.

I have the following record

I'm going to put a PHP page in the CRON task of Cpanel, but how can I make a query that checks every minute if the log is time and day to be triggered?

In this example of the image, you should return the record when: 9 hours 5 minutes Monday, Tuesday or Thursday

See what month and day you are with *

SELECT * 
FROM  'agendamento' 
WHERE 1 =1
AND (mes = MONTH(NOW() ))

How could I check the asterisk and not get into the conditions, I will use OR operator will it work?

    
asked by anonymous 22.06.2017 / 14:55

1 answer

0
SELECT *
FROM  agendamento
WHERE 1 =1
AND (
    (mes = MONTH(NOW())
    OR
    (mes = '*')
    )
AND (
    (dia = DAY(NOW())
    OR
    (dia = '*')
)

I think this is the way to go, although I think it will be much more interesting to have several Crons ...

    
22.06.2017 / 15:58