[solved] using active records WHERE with now() |
[eluser]Pale Rider[/eluser]
Ok, I'm a bit stumped. This returns no rows: Code: function get_funerals() but if I open up phpMyAdmin and do: Code: SELECT * .. that returns the right results. Is AR doing some sort of escaping that's messing up that query. Not sure why that is not working :o cheers
[eluser]bretticus[/eluser]
try printing the compiled query out to your browser: Code: function get_funerals() or turn on profiling to get a look: Code: function get_funerals() Oh by the way, when you return $query->result() you are just returning one row.
[eluser]Pale Rider[/eluser]
hmmm well i did Code: function get_funerals() and it gave me Code: SELECT * FROM (`funerals`) WHERE `visitation` > 'NOW()' o_O result just returns one result? What should I be using? I have many queries such as Code: function get_orders_stage1() .. and they seem to be returning all the right rows.
[eluser]bretticus[/eluser]
try Code: $this->db->where('visitation >', 'NOW()', TRUE); EDIT: Sorry, that would be FALSE instead of TRUE. If that doesn't work try: $this->db->where('visitation > NOW()');
[eluser]Pale Rider[/eluser]
Hmm, just tried Code: $this->db->where('visitation >', 'NOW()', TRUE); but no nice. I guess I can try doing a query(), just thought maybe it was something obvious with why AR wasn't giving me rows
[eluser]bretticus[/eluser]
[quote author="Pale Rider" date="1268439558"] result just returns one result? What should I be using? I have many queries such as [/quote] Check out the example for result() in the manual.
[eluser]Pale Rider[/eluser]
Ahh, thank you sir Just tried FALSE and it worked. I just looked up AR in the user guide, some how I missed Quote:If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. in there. Thanks for the help! cheers.
[eluser]bretticus[/eluser]
[quote author="Pale Rider" date="1268439784"]Hmm, just tried Code: $this->db->where('visitation >', 'NOW()', TRUE); but no nice. I guess I can try doing a query(), just thought maybe it was something obvious with why AR wasn't giving me rows [/quote] Read my edit above (it should have been FALSE not TRUE.) |
Welcome Guest, Not a member yet? Register Sign In |