I imported information from txt files. I have 3 files, and one field from this file is a price with different format.
The format on column is DECIMAL(12,5)
file 1 -> $price_1 = 000000000000024.99
file 2 -> $price_2 = 25476,99
file 3 -> $price_3 = 3,768.44
Before inserting in mySQL table I using folowing script:
For file 1
$price = (real)number_format($price_1 , 2, '.', '');
For file 2
$price = (real)str_replace(",", ".", $price_2);
For file 3
$price = (real)str_replace(",", "", price_3);
I do't know if this format is correct before I insert a record in the table? If there is any other solution I'll be very grateful. I apologize for my English. Thanks in advance!