Welcome Guest, Not a member yet? Register   Sign In
Error with complex Oracle query
#13

(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...
Reply


Messages In This Thread
Error with complex Oracle query - by jace - 08-03-2017, 05:33 PM
RE: Error with complex Oracle query - by jace - 08-05-2017, 09:59 AM
RE: Error with complex Oracle query - by jace - 08-05-2017, 09:36 AM
RE: Error with complex Oracle query - by jace - 08-07-2017, 09:29 PM
RE: Error with complex Oracle query - by pporlan - 08-08-2017, 03:40 AM
RE: Error with complex Oracle query - by jace - 08-08-2017, 07:44 PM
RE: Error with complex Oracle query - by jace - 08-15-2017, 12:14 AM
RE: Error with complex Oracle query - by jace - 08-15-2017, 12:01 PM
RE: Error with complex Oracle query - by jace - 08-16-2017, 11:36 PM
RE: Error with complex Oracle query - by jace - 08-17-2017, 02:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB