如何传递DateCreated> DATE_SUB(NOW(),INTERVAL 10 DAY);条件?

问题描述 投票:2回答:1

我是codeigniter的新手,我希望通过传递许多条件来选择用户的详细信息。我通过了一些条件:

 $this->db->where ( 'userprofile.Disability', $Disability);
 $this->db->where('userprofile.LivingCity', $LivingCity);

同样,我想通过这条件:

where DateCreated > DATE_SUB( NOW( ) , INTERVAL 10 DAY );//how to write in code igniter format?

如何用代码点火器格式写出^?

例如:

`$this->db->where('userprofile.DateCreated>', DATE_SUB( NOW( ) , INTERVAL 10 DAY);`// how to write this?

怎么写那个^?

我想传递这个条件来选择在10天之前插入值的人,我的选择表是:

$this->db->select('*');
$this->db->from('Userprofile');
php mysql database codeigniter
1个回答
4
投票

你应该在codeigniter中写自定义where条件。

$ where =“DateCreated> DATE_SUB(NOW(),INTERVAL 10 DAY)”;

$这 - > DB->其中($其中);

结帐CI的活动记录类:https://www.codeigniter.com/userguide2/database/active_record.html

© www.soinside.com 2019 - 2024. All rights reserved.