Tablename :- userinfo
Column :- expiration [ type:- text ]
Date format :- date('d M Y')
Database :- MySQL
Tech :- Codeigniter 3
表包含用户记录,我想通过到期日期过滤结果。
Active users :- $exp_date > $cur_date;
Expired users :- $exp_date < $cur_date;
最佳答案
使用OR
获取“Unlimited”值:
<?php
$this->db->select('*');
$this->db->from('userinfo');
$this->db->where('expiration <', $cur_date); // for expired users
OR
$this->db->where('expiration >', $cur_date); // for active users
$this->db->or_where('expiration', $unlimited_value); // or_where
?>
关于mysql - 如何在 Codeigniter 中查找活跃用户和过期用户并比较日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42392244/