Welcome Guest, Not a member yet? Register   Sign In
MYSQL problem
#1

[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


Messages In This Thread
MYSQL problem - by El Forum - 11-21-2012, 05:43 PM
MYSQL problem - by El Forum - 11-21-2012, 06:25 PM
MYSQL problem - by El Forum - 11-21-2012, 07:15 PM
MYSQL problem - by El Forum - 11-22-2012, 12:57 AM
MYSQL problem - by El Forum - 11-22-2012, 01:06 AM
MYSQL problem - by El Forum - 11-22-2012, 04:01 AM
MYSQL problem - by El Forum - 11-22-2012, 04:14 AM
MYSQL problem - by El Forum - 11-24-2012, 07:07 AM
MYSQL problem - by El Forum - 11-24-2012, 12:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB