r_a_f
(Rfa)
1
I have form to insert rows to database. All created in gii (model & crud). Its simple table (id INT, name text, quantity INT)

When i try insert via form quantity 1,41 (or 1.41) - I always have answer “FIELD must be an integer” and i can’t insert this…

What im doing wrong?

Yii 1.1.5 & sqlite3

(sry for my English)

andy_s
(Arekandrei)
2
I don’t understand? Use DECIMAL type and modify corresponding model’s rules.

r_a_f
(Rfa)
3
THANKS for quick answer andy_s

Where should I use DECIMAL?

In sql table?? or in Model?

All I need is save in table integers like 1.41 or 15.10

thanks

Flavio
(Flavioleonelferreira)
4
change the field in database to DECIMAL or FLOAT (alter table …)

change the model rule to NUMERICAL ( array(‘quantity’,‘numerical’) )

r_a_f
(Rfa)
5
THANK YOU VERY MUCH Flavio & andy_s

DECIMAL in sql table do THE JOB

Its sqlite3 so I’m surprised for decimal type but it works.

thanks again

greetings

jacmoe
(Jacob Moen)
6
1.5 is not an integer.

It’s a floating point value / decimal number.

Integers are whole numbers.

r_a_f
(Rfa)
7
Right Viking

INTEGER worked for me as floating point v./decimal in sqlite3 & simply php programing before i work with Yii

… bad habit

thanks

jacmoe
(Jacob Moen)
8
I am used to languages with strict type-checking, like C++.