Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Query Builder - finding the number of records from a certain date not wor

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?

Theme © iAndrew 2016 - Forum software by © MyBB