Changing Fields in Database

Asked

Viewed 23 times

0

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

I’m having difficulties to do this procedure automatically, and I saw that I can do it both in the bank and with php on the web page I’m creating, but I haven’t had success yet. Could someone help me?

1 answer

0


You can create a PHP routine for this:

mysqli_query($conn, "UPDATE Treinamentos SET status = 0 WHERE DATE(NOW()) >= Validade");
  • It worked, obg!

  • 1

    Mark as correct answer! A @Thiagovieira

Browser other questions tagged

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