Change a table in the database from a date in another table

Asked

Viewed 36 times

0

I have a ban_logs table that contains a date and needs that after that date, an event or Trigger is enabled to change the is_banned field of the user_data table.

ban_logs id, user_id, date, until_date;

user_data user_id, is_banned;

When the date equals the until_date(DATETIME) field, run an event to set the is_banned field = 0 Where user_id = user of the ban_logs table.

Someone has a tip?

Thank you

1 answer

0

Using PHP, you could use the sub() and diff methods of the Datetime() class, each time the page is loaded the dates are checked, depending on the result of the check, you can apply a javascript to dynamize Trigger

  • The idea is to create an event, or add a date to the event from the until_date so that it runs only when the date is reached. I don’t know if it was clear. .

Browser other questions tagged

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