Welcome Guest, Not a member yet? Register   Sign In
Bug in Active Record WHERE function
#1

[eluser]Neil_W[/eluser]
Hello,
The manual says you can enter a customer string as the where clause. So I entered the following:

Code:
$where="parent_id=0 AND (status='$status' OR platform like '$platform%')";
        $this->db->where($where);

However, the system returns an error because it is trying to put back ticks around all of the first clause, i.e.:
Code:
Unknown column 'parent_id=0' in 'where clause'

SELECT `easylink`, `name` FROM (`retro_games`) WHERE `parent_id=0` AND (status='finished' OR platform like '%') ORDER BY `name` asc

If I swap it around it seems to manage ok:
Code:
$where="(status='$status' OR platform like '%$platform%') AND parent_id=0";
        $this->db->where($where);


Is there something missing?

btw, I think what's missing from the active record methods is the ability to set a flag in the WHERE, etc functions to bracket the current entry. That way I could have used the other methods to chain the where clauses together.


Messages In This Thread
Bug in Active Record WHERE function - by El Forum - 02-26-2010, 05:30 PM
Bug in Active Record WHERE function - by El Forum - 02-26-2010, 06:13 PM
Bug in Active Record WHERE function - by El Forum - 02-26-2010, 06:53 PM
Bug in Active Record WHERE function - by El Forum - 02-26-2010, 07:18 PM
Bug in Active Record WHERE function - by El Forum - 04-27-2011, 06:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB