my database table looks like below
| id | user_name | address | contact | date | |----|-----------|---------|---------|----------| | 1 | john | NY
Remove ; semicolon after NOW() function, semicolon is break query so YySql understand another query after semicolon this query would work
;
NOW()
$result = $this->db->query('SELECT * FROM '.$table.' WHERE `date` BETWEEN DATE_SUB(NOW(), INTERVAL 15 DAY) AND NOW() AND '.$condition);