Welcome Guest, Not a member yet? Register   Sign In
Active record and date in where statement
#14

[eluser]smilie[/eluser]
mddd,

I stumbled upon something.

Code:
Code:
$this->db1 = $this->load->database('db',TRUE);
$this->db1->where('created >= NOW() - INTERVAL 1 DAY','',FALSE);
$this->db1->from('table');
$res = $this->db1->count_all_results();

Produces:
Code:
SELECT COUNT(*) AS `numrows`
FROM (`table`)
WHERE created >= NOW() - INTERVAL 1 DAY

This is from the profiler. CodeIgniter returns 0 found rows.
Same query in the PHPMyAdmin returns 1 found row.

However I saw in another query that WHERE / AND statement is like this:
Code:
AND `id` = 'action_id'

Now, I do not know if this is profiler 'error' or my browser - or...
But, when I copy & paste query in PHPMyAdmin it also returns 0 results.
However, if I remove quotes from the query (particullary these -> `` quotes) - then it is working.

Maybe this helps some? :-)

Regards,
Smilie


Messages In This Thread
Active record and date in where statement - by El Forum - 07-21-2010, 09:14 AM
Active record and date in where statement - by El Forum - 07-21-2010, 09:36 AM
Active record and date in where statement - by El Forum - 07-21-2010, 09:37 AM
Active record and date in where statement - by El Forum - 07-21-2010, 09:44 AM
Active record and date in where statement - by El Forum - 07-21-2010, 09:53 AM
Active record and date in where statement - by El Forum - 07-21-2010, 01:29 PM
Active record and date in where statement - by El Forum - 07-21-2010, 02:57 PM
Active record and date in where statement - by El Forum - 07-21-2010, 09:16 PM
Active record and date in where statement - by El Forum - 07-22-2010, 12:35 AM
Active record and date in where statement - by El Forum - 07-22-2010, 02:06 AM
Active record and date in where statement - by El Forum - 07-22-2010, 02:16 AM
Active record and date in where statement - by El Forum - 07-22-2010, 02:31 AM
Active record and date in where statement - by El Forum - 07-22-2010, 02:40 AM
Active record and date in where statement - by El Forum - 07-22-2010, 02:49 AM
Active record and date in where statement - by El Forum - 07-22-2010, 04:11 AM
Active record and date in where statement - by El Forum - 07-22-2010, 04:18 AM
Active record and date in where statement - by El Forum - 07-22-2010, 04:29 AM
Active record and date in where statement - by El Forum - 07-22-2010, 04:37 AM
Active record and date in where statement - by El Forum - 07-22-2010, 05:31 AM
Active record and date in where statement - by El Forum - 07-22-2010, 05:50 AM
Active record and date in where statement - by El Forum - 07-22-2010, 05:54 AM
Active record and date in where statement - by El Forum - 07-22-2010, 06:03 AM
Active record and date in where statement - by El Forum - 07-22-2010, 06:16 AM
Active record and date in where statement - by El Forum - 07-22-2010, 06:31 AM
Active record and date in where statement - by El Forum - 09-25-2010, 10:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB