CodeIgniter Forums

Full Version: Codeigniter Query Builder - finding the number of records from a certain date not wor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Within codeigntier, I have the following:

echo $this->db->where('FROM_UNIXTIME(`last_login`) >=','NOW() - INTERVAL 1 DAY')->from('users')->count_all_results();

The above produces the result: 0

I used print_r($this->db->last_query()); to get the actual sql string being run and it is as follows:

SELECT COUNT( * ) AS  `numrows`
     FROM  `users`
    WHERE FROM_UNIXTIME(  `last_login` ) >= NOW( ) - INTERVAL 1

When I run it from with mysql, I get the correct result: 1.

I am guessing that the escaping is now working or something but cannot figure it out. Any idea?