[eluser]jentree[/eluser]
I am so close, yet so far...
I have a large list of items. Each item has a "timestamp" for its creation date.
I want to return a list of all items for any given year.
The timestamp looks like this:
So my query looks like this:
Code:
$this->db->order_by('item_name', 'asc');
$this->db->where('DATE_FORMAT(timestamp, "%Y")', $year);
$query = $this->db->get('items');
if ( $query->num_rows() > 0 )
{
return $query->result();
}
else
{
return FALSE;
}
$year is passed into my function as an intiger (2012 for example)
Which produces this:
Code:
SELECT * FROM (`exhibitor_contracts`) WHERE DATE_FORMAT(timestamp, "%Y") '2012' ORDER BY `company_name` asc
I (somehow) just need to get the "=" in there right before the 2012. So my query ultimatly looks like this:
Code:
SELECT * FROM (`exhibitor_contracts`) WHERE DATE_FORMAT(timestamp, "%Y") = '2012' ORDER BY `company_name` asc
Thank you for your help!