使用 PHP 在 24 P.M (0.00 A.M) 后自动更新此列? [英] Auto Update this column after 24 P.M ( 0.00 A.M ) with PHP?

查看:30
本文介绍了使用 PHP 在 24 P.M (0.00 A.M) 后自动更新此列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个列ALLTime"(int (4) 类型)!

I have this column "ALLTime" ( int (4) type ) !

我的查询更新(针对 account_vip 表的所有 ID)

My query Update for it ( for all ID of account_vip table )

mysql_query(Update account_vip SET ALLTime = ALLTime - 1);

示例:ALLTime 列现在都是 8,所以在 0.00 AM 之后,它们将变为 7 !

Example: ALLTime column all now are 8, so after 0.00 AM, they will become 7 !

但我希望它在下午 24 点(上午 0.00 点)之后自动更新 - 1 并且不要变成负数(例如 -1、-2、...、-n),只在 ALLTime 仍然 >= 0 时工作!

But i want it Auto Update - 1 after 24 P.M ( 0.00 A.M ) and don't get negative ( like -1, -2, ..., -n ), just working when ALLTime still >= 0 !

推荐答案

首先,您需要创建一个 CRONJOB 并根据需要设置时间表,您的查询应该是:

First of all you need to create a CRONJOB and set schedule as you need and your query should be:

Update account_vip SET ALLTime = ALLTime - 1 WHERE ALLTime > 0;

使用 ALLTime >0; 它不会更新 -ve 值.

Use ALLTime > 0; it will not update -ve value.

这篇关于使用 PHP 在 24 P.M (0.00 A.M) 后自动更新此列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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