• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving results by month...

#1
[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! Smile


Messages In This Thread
Retrieving results by month... - by El Forum - 04-29-2010, 05:51 PM
Retrieving results by month... - by El Forum - 04-29-2010, 07:03 PM
Retrieving results by month... - by El Forum - 04-30-2010, 01:40 AM
Retrieving results by month... - by El Forum - 04-30-2010, 02:38 AM
Retrieving results by month... - by El Forum - 04-30-2010, 05:02 AM
Retrieving results by month... - by El Forum - 04-30-2010, 05:11 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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