Changing Fields in Database

0

Hi! I created a database with a Treinamentos table that has Nome , Validade and Status as fields, but when the current date passes from the expiration date the status field, which is 1 to active and 0 to inactive, needs to change to 0 .

I'm having trouble doing this automatically, and I've seen that I can do this both in the bank and with php on the webpage I'm creating, but I have not yet succeeded. Could someone help me?

    
asked by anonymous 05.11.2017 / 00:16

1 answer

0

You can create a PHP routine for this:

mysqli_query($conn, "UPDATE Treinamentos SET status = 0 WHERE DATE(NOW()) >= Validade");
    
05.11.2017 / 01:02