Welcome Guest, Not a member yet? Register   Sign In
Dealing with currencies
#1

[eluser]Michael Nielsen[/eluser]
what 'type' do I set mysql to when dealing with currencies.

e.g do I use INT?
#2

[eluser]Colin Williams[/eluser]
Sure, if you want to completely ignore floating point numbers. Decimal might be better...
#3

[eluser]Dam1an[/eluser]
Micheal, INTs only deal with whole numbers, 1,2,3,4,5... SO they're be fine if you wanted to store the currentcy as number of pence (so 100 is £1), but you'd probably be better off using decimal as Colin said Smile
#4

[eluser]Michael Nielsen[/eluser]
I've changed it to float and it seems to be working, is this type going to work properly with currencies?
#5

[eluser]slowgary[/eluser]
Float allows decimals and would probably work, but it's less accurate for currency then decimal. You should probably use the decimal type.
#6

[eluser]Michael Nielsen[/eluser]
[quote author="slowgary" date="1242537025"]Float allows decimals and would probably work, but it's less accurate for currency then decimal. You should probably use the decimal type.[/quote]

I did but it didn't work.

Any idea why?
#7

[eluser]slowgary[/eluser]
It's lazy? It'd rather collect unemployment? Maybe it just can't find a job due to global recession.

What is 'it'?
#8

[eluser]Michael Nielsen[/eluser]
Decimal.
#9

[eluser]Colin Williams[/eluser]
Help us help you, Michael. How did it not work? How did you set it up? What does your SQL look like?




Theme © iAndrew 2016 - Forum software by © MyBB