(08-15-2017, 05:04 AM)Kaosweaver Wrote: In blue in your post is a $this->db->select() where you have a FROM and WHERE
Then you have a $this->db->where() which appends the SELECT with "WHERE..." giving you the two WHEREs in the SQL.
Take out all of the WHERE commands and FROM commands within the SELECT command - and use the respective $this->db->from() and $this->db>where() to construct those.
I don't think the SQL in the $this->db->select() is the problem. Yes, there are two WHERE clauses, but the one is embedded in parenthesis with it's own select. That works fine. It's when I do a search.
The other WHERE is coming from this part of the code that I posted, outside of the $this->db->select(). Specifically the first
like:
foreach ($this->column_search as $item) {
if ($_POST['search']['value']) {
if ($i === 0) {
$this->db->group_start();
$this->db->like('LOWER(' . $item . ')', strtolower($_POST['search']['value'])); // fix to make case-insensitive
} else {
$this->db->or_like('LOWER(' . $item . ')', strtolower($_POST['search']['value'])); // fix to make case-insensitive
}
I've tried using $this->db->where() and $this->db->from(), etc, to construct this, but it always points back to the same error. I know there's a way to group the like clauses into the query I have, to where it's expressed as an AND instead of an additional WHERE, but I haven't figured it out yet.
Thank you...