• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Codeigniter Query Builder - finding the number of records from a certain date not wor

#1
Within codeigntier, I have the following:

Code:
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:

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

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?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.