I have a MySQL table structured: float(10,2)
For example I insert a row.
$value = array('price' => '13539.51');
$db->insert($value);
When I check this row with phpmyadmin, everything is fine. But when I read this row with Zend Db, price value like this "13539.509765625". How can i fix this problem.
$select = $db->select();
$select->where('id = ?' 1);
echo $db->fetchRow($select)->price;
//13539.509765625
I think your issue lies with the data type you chose for your column and not Zend_Db. You might want to alter it to be a DECIMAL(10,2).
http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html
Cheers, Angel