Decimal fields acting weird

Hello forum,

Im making a form application that inserts a decimal number into a MySQL database. I’ve put regional settings off and changed the decimal separator to a comma.

When I try to insert the value I get the error "Incorrect decimal value for ‘1000,25’ ".

Stuff I’ve tried:
Setting the comma to a period in the Decimal Separator.
OnBeforeInsert try to use the php functions str_replace and number_format to replace the comma with a period.
Tried setting the decimals to doubles, which leads to a truncation of the data before the comma. 1000,00 became 1,00.
Tried setting the fields to currency, which leads to the same error.

No matter what I try it still tries to insert a comma when MySQL expects a dot as separator.

I’m using UTF-8 and English(United States) as regional.

UPDATE: Printing the value even gave 1000.25, but the pdo-mysql statement still tries to insert 1000,25.

Please help :frowning:

Fixed it by setting the decimal fields to text fields. It still inserts as decimals into the database.

Are you on windows???
You have to set your project to the proper country settings. And be aware that the country settings are also appropriately the same as for the database.
My golden rule is: if I am in a characterset on the web I have to be in the same characterset on the database and vice versa… Then you should have no problems…
So check you deployment settings and your db characterset…

Yes I am on windows.
Changed the country settings to the same as the database, and it worked!

Thank you :slight_smile: