Welcome Guest, Not a member yet? Register   Sign In
How to use TRUE/FALSE values in an Active Record statement?
#1

[eluser]xcristi[/eluser]
Hi guys,

So, I have one postgresql table with a boolean type field (mn_active).
And I have a need for a statement who take care of that field, something as:
Code:
$q = $CI->db->getwhere('menu', array('mn_menu' => 2, 'mn_active' => true));

The error looks like:

Code:
ERROR: operator does not exist: boolean = integer HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.

SELECT * FROM menu WHERE mn_menu = 1 AND mn_active = 1

So, how can I use boolean values (true / false) instead of integers ?
Thanks.
#2

[eluser]megabyte[/eluser]
I would think since its in an array that its not associating the word true as a booleen. try putting it in quotes or use a numeric 1 and 0 for your true and false. I've never used Postgresql.
#3

[eluser]xcristi[/eluser]
Code:
'mn_active' => 'true';

DID the trick.
Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB