【发布时间】:2015-09-03 20:07:44
【问题描述】:
我正在使用 PHP Codeigniter
我的表用户的字段余额日期类型为 ENUM('Yes','No')。我还有一个名为 reset_date 的字段,它存储用户余额设置为 yes 的日期。所以我想计算 30 天,30 天后想再次将该用户余额重置为 No。因此,对于每个用户,如果他的余额用户设置为是,那么我想计算 30 天并在 30 天后重置余额。
当 Balance 设置为 yes 时,我正在存储当前日期:
if($this->input->post('balance') === "Yes")
{
$key= $this->session->userdata('key');
$this->reseller_m->deduct($key);/// pass youe id here
$this->load->helper('date');
$this->db->set('reset_date',unix_to_human(now()));
$this->db->where('id',$id);
$this->db->update('users', $data);
}
【问题讨论】:
标签: php codeigniter cron