Welcome Guest, Not a member yet? Register   Sign In
Working with CURRENT_TIMESTAMP
#9

[eluser]codemonkey[/eluser]
Holy smokes, I think I'm getting somewhere. If i do

Code:
function get_actions_oneweek()
{
$this->output->enable_profiler(TRUE);

$startDate = date("Y-m-d", mktime(0, 0, 0, date('m'), date('d') - 14, date('Y')));
$endDate = date("Y-m-d", mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));  

$total_actionsweek = 0;
$this->db->select('id');
$this->db->select('COUNT(id) AS total');
$this->db->where('date_created >', $endDate);
$actionweekrows = $this->db->get('item_history')->result_array();

foreach ($actionweekrows as $count => $actionweekrow)
{
$total_actionsweek = ($total_actionsweek + $actionweekrow['total']);
}

return $total_actionsweek;
}

It returns the correct number!!!!

If I can get the between to work this will be amazing!


Messages In This Thread
Working with CURRENT_TIMESTAMP - by El Forum - 09-11-2012, 10:14 AM
Working with CURRENT_TIMESTAMP - by El Forum - 09-11-2012, 11:55 AM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 01:15 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 01:31 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 01:59 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 02:02 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 02:08 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 02:09 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 02:12 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 02:18 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 04:24 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 04:30 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-12-2012, 05:34 PM
Working with CURRENT_TIMESTAMP - by El Forum - 09-13-2012, 03:58 AM
Working with CURRENT_TIMESTAMP - by El Forum - 09-13-2012, 06:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB