[eluser]Thiago Leao[/eluser]
INSERT INTO `buy` (`id_products`, `date_start`, `date_finish`) VALUES ('341', 'CURDATE()', 'CURDATE() + INTERVAL 30 DAYS')
The date functions are going to string!
------------------------------------------------------
What I see is that I will have to use the helper date because the date function of php will not work!
Code:
function insertBuy($id_products, $id_user){
$this->load->helper('date');
$datestring = "%Y-%m-%d";
$time = time();
$array = array('id_products' => $id_products, 'id_user' => $id_user, 'date_start' => mdate($datestring, $time), 'date_finish' => 'mdate($datestring, $time)+ INTERVAL 30 DAY', 'valor_venda' => '50');
$teste = $this->db->insert_string('buy', $array);
echo $teste;
}
PRINT = INSERT INTO `buy` (`id_products`, `id_user`, `date_start`, `date_finish`, `valor_venda`) VALUES ('340', '26fe30c72414ab935f3cf8eb531b6b5e', '
2012-02-15', 'mdate($datestring, $time)+ INTERVAL 30 DAY', '50')
Now we need to add 30 days +!!!