嘿伙计们,可以说我有一个成员放了 20 天。因此,如果有会员 20 天后,可以说没有登录,它将改变那里的状态。但仅基于在 MySQL 数据库中写入的状态更改日期为year-month-day
. 因此,如果他的状态更改日期已经过去了 20 天,那么他的状态就会发生变化。
如果您能帮助我了解如何执行此操作,我将不胜感激!
大卫
更新:
代码:
$newStatus = "Non-Active - Driver Chose Non-Compliance";
$sql = "SELECT username,ATF FROM members WHERE username = 'test'";
$getcsvuser = $DBH->prepare($sql);
$getcsvuser->execute();
while($row = $getcsvuser->fetch(PDO::FETCH_ASSOC)){
$memusername = $row['username'];
$memATF = $row['ATF'];
if ($memATF != 0 || $memATF != "0")
{
$tsql = "SELECT username,status,memberview ,statuschangedate FROM csvdata WHERE memberview =:user";
$tgetcsvuser = $DBH->prepare($tsql);
$tgetcsvuser->execute(array(':user' => $memusername));
while($trow = $tgetcsvuser->fetch(PDO::FETCH_ASSOC)){
$csvstatus = $trow['status'];
$csvusername = $trow['username'];
$csvdate = $trow['statuschangedate'];
if($csvstatus == "Open" || $csvstatus == "Enrolled - Policyholder Follow-Up Required" || $csvstatus == "Enrolled - Employee Follow-Up Required" || $csvstatus == "Non-Active - Insurance Cancelled" || $csvstatus == "Non-Active, Unable to Monitor - Incidental Business use Exclusion" || $csvstatus == "Non-Active - Employee Not Covered Under Listed Policy" || $csvstatus == "Non-Active - PolicyHolder Cancelled Additional Interest")
{
$newsql = "UPDATE csvdata SET status = :newstatus WHERE statuschangedate < NOW() - INTERVAL :atf DAY AND username =:mem";
$newgetcsvuser = $DBH->prepare($newsql);
$newgetcsvuser->execute(array(':newstatus' => $newStatus, ':atf' => $memATF, ':mem' => $csvusername));
while($rrow = $newgetcsvuser->fetch(PDO::FETCH_ASSOC)){
echo "working";
}
}
}
}
}