简体   繁体   English

如何使用php + Mysql更新列表状态

[英]how update list status once using php+Mysql

I have a list contains date , status fields. 我有一个包含datestatus字段的列表。

Title OutDate Status Content1... 2014-12-11 Stop Content2... 2014-12-16 Running Content3... 2014-12-15 Running Content4... 2014-12-03 Stop

This is my list above.I want update the field status from running to stop automatic when outdate before today.I think query and update using sql when fresh list eveytime is waste resource.I hope I can update the status once. 这是我上面的列表。我希望从今天起将字段status从运行status更新为自动停止运行。我认为当新鲜的列表eveytime浪费资源时,使用sql查询和更新。我希望可以一​​次更新status

By the way.I dont want to use cronjob.I want to use php. 顺便说一句。我不想使用cronjob。我想使用php。 (Forgive my poor English...) (原谅我可怜的英语...)

$current=date('Y-m-d');
$curdate=strtotime($current);
$project=strtotime($datz); //$datz is fetched from db

if($curdate > $project) {
    //query
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM