Skip to main content
Inspiring
May 2, 2012
Question

salary. what phpmyadmin type - i used float

  • May 2, 2012
  • 1 reply
  • 4626 views

i have used float 6,2 for a salary but it doesnt show the correct figure,

if the applicant inputs 25,000 i need it to come out like that or 120,000

thanks

jon

This topic has been closed for replies.

1 reply

Known Participant
May 2, 2012

Use decimal. See http://dev.mysql.com/doc/refman/5.5/en/fixed-point-types.html for more info.

But basically, 5,2 would get you 999.99, 5 being the total size of the field. So for salary I use 9,2. Also the presentation is not in the database but in your code. Assuming you are using PHP take a look at  the number_format() function: http://php.net/manual/en/function.number-format.php.

And if you want to point and click, search the exchange for "number formats". There are probably a few extensons available.

Inspiring
May 2, 2012

thanks the the problem i have is public are added a salary required and are inputting all sorted of this like

25.000 + per annum

+ 25000 - 30000

25,000

so is decimal the best for this because with varchar is was getting a  symbol

can you suggest anything?

Known Participant
May 2, 2012

I don't understand your question. But if you need, you ahve have more then one decimal field.