根据其他字段的值自动更新mysql字段 [英] automatically update mysql field based on value of other field

查看:679
本文介绍了根据其他字段的值自动更新mysql字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于订阅详细信息的mysql表

I have a mysql table for subscription details

它具有开始日期,结束日期和状态字段

It has a start_date, end_date and status field

现在,我想做的是只要到达订阅的结束日期,我希望状态字段从有效更改为无效

Now, what i would like to do is whenever end_date of subscription is reached, i would like the status field to change from active to inactive

例如,当end_date> curdate时,更新订阅表设置status = inactive

for example when end_date > curdate, update subscription table set status=inactive

是否可以在每天结束时进行检查以进行检查和更新?

Is there a way to run a check at the end of each day to check and update this?

我该怎么做?

推荐答案

您可以在基于linux的服务器中使用cron job来使用php检查和操作db中的数据

you can use the cron job in linux based server to check and manipulate the data in db with php

这篇关于根据其他字段的值自动更新mysql字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆