Re: Field type for american money

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For mysql, it's better to use int and then store it in cents (or
micros) so you can use all integer operations instead of float ones.

On 6/11/09, Shawn McKenzie <nospam@xxxxxxxxxxxxx> wrote:
> revDAVE wrote:
>> Php - MySQL - newbie question
>>
>> - Field type for american money - int(11) seems to work fine
>>
>> - but also I tried decimal(10,2)
>>
>> Is one a better choice than another for american money usage?
>>
>>
>> --
>> Thanks - RevDave
>> Cool @ hosting4days . com
>> [db-lists 09]
>>
>>
>>
>
> If you are only interested in round dollar amounts then int should work
> fine ;-)  If you expect any fractions of a dollar (as I suspect you
> will), such as 19.95 then use decimal.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux