Codeigniter: how to get data between today and last 15 days from database

前端 未结 5 397
谎友^
谎友^ 2021-01-13 00:55

my database table looks like below

| id | user_name | address | contact | date | |----|-----------|---------|---------|----------| | 1 | john | NY

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 01:14

    I think the best way You can use dateiff to get any query between any two dates by days like this

        $result  = $this->db->query("SELECT * FROM ".$table." WHERE datediff('". $your_date ."', row_date) <= 15")->get()->result();
    

提交回复
热议问题