12
I am using a mysql database, the format of the field is Decimal (7,2)
and he gets his salary.
Based on what the user types I store in the bank so:
str_replace(',','.', $_POST['txtSalario'])
Replace the comma by the dot.
The problem is that if it type ex: 3.145,89, the database refuses because it understands that the first point is already decimal.
How to treat this data entry to receive typed values such as 3145,89 or 3,145,89?
I’m using the PHP 5.3
and mysql 5.5
Yes, at the time I put a function to edit the value it sets the value as 999999
– Israel Zebulon
Stores 999999 when you typed what before? And what code was used to handle?
– Maicon Carraro
For example: I added 2601.34 and recorded it. All right. On the edit screen I take this value from the bank and put it in an input field. Assuming I didn’t change anything and click save, the system converts to 99999
– Israel Zebulon
When it comes back from the field the value placed in the input is ex: 322.88. I think I need to solve this
– Israel Zebulon
It worked here I needed to treat the field before sending input to solve.
– Israel Zebulon
You’ve dealt in what way?
– Maicon Carraro
On the edit screen : $value = $value = str_replace('.', ','$Numvalue);<br>E to save used a function to clear.
– Israel Zebulon