I have a column in MYSQL database table called available_balance float(10,2), Its all fine but its storing value 0.00 instead of 00.00 or if 09.33 its storing 9.33. Instead I am looking for 09.33 to store, I can display 09.33 using PHP but since I have large data, I do not want process to convert numbers in PHP if mysql database with Float Column allow me to store number like 00.00 and 09.33 etc.
Let me know if anyone here can help me for solve the puzzle. Thanks!
>Solution :
You can display it with the format you need but not store it with float column type,
Use function LPAD() to show the numbers (left) padded with zeros:
select id, LPAD(available_balance,5,"0") from my_table
result
id LPAD(available_balance,5,"0")
1 05.00
2 50.20
3 01.20