Код: Выделить всё
| id | user_name | address | contact | date |
|----|-----------|---------|---------|----------|
| 1 | john | NY | 12345 |2015-4-20 |
| 2 | Mart | NY | 54345 |2015-4-05 |
| 3 | Drew | US | 67340 |2015-3-14 |Код: Выделить всё
function orders()
{
$data['orders'] = $this->common_model->get_data_between_15days('tbl_orders',array('status'=>'1'));
$data['title']='Orders';
$data['main_content']='users/orders_view.php';
$this->load->view('admin/includes/template',$data);
}
Код: Выделить всё
public function get_data_between_15days($table, $condition)
{
$result = $this->db->get_where($table, $condition);
if($result)
{
return $result->result_array();
}
}
Код: Выделить всё
$result = $this->db->query('SELECT * FROM '.$table.' WHERE date BETWEEN DATE_SUB(NOW(), INTERVAL 15 DAY) AND NOW(); AND '.$condition);
Подробнее здесь: https://stackoverflow.com/questions/297 ... m-database
Мобильная версия