gpt4 book ai didi

mysql - 如何在 Codeigniter 中查找活跃用户和过期用户并比较日期?

转载 作者:行者123 更新时间:2023-11-29 19:21:55 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com