[eluser]123wesweat[/eluser]
I had to add an conditional to a method
and how do i turn this query into
Code:
$q = $this->db->query("SELECT * FROM table WHERE inputDate BETWEEN '".$search."' AND '".$now."'");
an active records one like
Code:
$q = $this->db->like($search_field, $search)->get('table', $per_page,$offsetOfJobs);
so how do i replace the like($search_field, $search) for a WHERE BETWEEN statement???
here's more of my method
Code:
function get_sort_search($per_page,$offsetOfJobs,$search, $search_field) {
if($search_field == 'test') {
$now = date("Y-m-d");
if($search == 1 ) {
$searchdate = date("Y-m-d", strtotime('-'.$search.' day'));
} else {
$searchdate = date("Y-m-d", strtotime('-'.$search.' days'));
}
$q = $this->db->query("SELECT * FROM table WHERE inputDate BETWEEN '".$searchdate."' AND '".$now."'");
} else {
$q = $this->db->like($search_field, $search)->get('table', $per_page,$offsetOfJobs);
}
//print_r($q);
if( $q->num_rows() > 0 ) {