[eluser]Speedy`[/eluser]
Hi there,
I have one little problem here.
I am trying to use database functions from codeigniter but it seems there is a problem with the functions or my code.
I have this
$this->db->where('date',$data['date']);
$query = $this->db->get('exchangerates');
with $this->db->last_query() it generates this
SELECT * FROM (`exchangerates`) WHERE `date` = '2012-11-21'
the $query->num_rows() returns 0 even if in the database are records with this date.
same problem at insert.
$exchange = array(
'date' => $data['date'],
'usd' => $data['usd'],
'eur' => $data['eur']
);
$this->db->insert('exchangerates',$exchange);
echo $this->db->last_query(); generates this
INSERT INTO `exchangerates` (`date`, `usd`, `eur`) VALUES ('2012-11-21', '3.5474', '4.5339')
When I run this sql from phpmyadmin it is all OK. From codeigniter the date is inserted as '0000-00-00'
Can anyone tell me how to solve this problem? I have tried to convert string to date from human to unix, to call date() but nothing happened.
Thanks