Hello all,
I wasn't sure if I should post this to the DB forum or PHP, so I took a shot...
I need to record the price of an item in a database field.
The value could be anywhere from 10.95 to 120.95.
Then I need to show that value as plain HTML as well as a value in a text field. Do you have any suggestions as to
1/ the best field type in mysql?
2/ and if needed the best way to format the value from php to the browser?
Right now I'm trying DECIMAL(7,2) but if I put a test value of 1,200.00 into the field it comes out 12.00.
Your help is appreciated,
Thanks,
dstefani
Currency: php/mysql
Moderator: General Moderators
- dull1554
- Forum Regular
- Posts: 680
- Joined: Sat Nov 22, 2003 11:26 am
- Location: 42:21:35.359N, 76:02:20.688W
i would suggest a float
something like this
field name is price(or whatever) and a float with a length of 11(or whatever)
but this will keep whatever decimal you put into it
something like this
Code: Select all
`price` FLOAT( 11 ) NOT NULLbut this will keep whatever decimal you put into it