[eluser]wakey[/eluser]
Hi,
I've been trying to get this sorted for a while and can't seem to get it to work.
I have records in my mysql database that each have column containing the current timestamp as default. I am attempting to select all records from the current month.
I have a feeling I need to use code such as:
Code:
$month = date('n')
$this->db->where('MONTH(current_time)', $month);
$this->db->where('user_id', $uid);
$query = $this->db->get('hits');
I have tried the following SQL statement in my db which returns the value '4' - SELECT MONTH('2010-04-29 23:11:45')
But when I try this statement on my 'current_time' field (which contains current timestamps) it returns NULL.
Does anyone have any ideas?! Any help appreciated!