This topic is locked

numbers with commas not inputting correctly

2/19/2023 10:57:58 AM
PHPRunner General questions
B
bioman author

Hi,
I made some accounting software for my wife in which she inputs expenses and payments etc. for her business. We've noticed that numbers with commas, like 20,000, do not get stored correctly. Instead 20,000 would get stored as 20.00. It seems the comma is the problem. If the comma isn't added (ex. 20000), the number shows up correctly.

The issue is that she is often copying and pasting the numbers from other invoicing software and the commas are present there so anytime she copies numbers bigger than 999, they are stored incorrectly in the database. How can this be fixed so that she can paste numbers in without this issue?

jadachDevClub member 2/19/2023

Maybe change the data type to text. Then you can convert after.

admin 2/19/2023

I think the easiest option is to implement "editing" field event that would read the current field content and remove commas.