I have column in the database with type of column decimal(10,2).
When I try it save model with number (for example 45.28), so the value stored in the database is 45.00
Why are not saved number after the decimal point?
Where is the problem?
Thanks
If you created the model using Gii, make sure that in rules()
the property integerOnly
is false.
array(......'numerical', 'integerOnly'=>false);
Another possible solutions:
array('your-attribute', 'type', 'type'=>'float'),
array('your-attribute', 'match', 'pattern'=>'/^[0-9]{1,10}(\.[0-9]{0,2})?$/'),