Welcome to Dream.In.Code
Become an Expert!

Join 150,072 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,769 people online right now. Registration is fast and FREE... Join Now!




What Kind Of Variable

 
Reply to this topicStart new topic

What Kind Of Variable

fyrestorm
10 Oct, 2002 - 01:37 PM
Post #1

D.I.C Lover
Group Icon

Joined: 4 Apr, 2002
Posts: 3,103



Thanked: 2 times
Dream Kudos: 228
My Contributions
i have to put a price as a field in a mysql database, and i need it to be in the form #.## what would i use as the field type, i tried floating but it got rid of my last zero, so i couldn't have 1.50

help.
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: What Kind Of Variable
10 Oct, 2002 - 01:55 PM
Post #2

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 15,277



Thanked: 61 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
I just use text, cause then you can put 9.99 or 9.90 or whatever... if you want to use a number field, use a small_int (I think that's big enough) and then when you pring out the value, use a sprintf function (Again, I think) to format the result properly.
User is offlineProfile CardPM
+Quote Post

fyrestorm
RE: What Kind Of Variable
10 Oct, 2002 - 02:02 PM
Post #3

D.I.C Lover
Group Icon

Joined: 4 Apr, 2002
Posts: 3,103



Thanked: 2 times
Dream Kudos: 228
My Contributions
i finally did just turn to using text, a little test and i saw that it worked, thanks for that info though...
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: What Kind Of Variable
11 Oct, 2002 - 03:02 PM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,355



Thanked: 51 times
Dream Kudos: 25
My Contributions
I'm fairly new to mysql. Is there no "money" type,as there is in SQL Server? TIA for the info
User is offlineProfile CardPM
+Quote Post

capty99
RE: What Kind Of Variable
11 Oct, 2002 - 03:06 PM
Post #5

the real kya
Group Icon

Joined: 26 Apr, 2001
Posts: 9,256



Thanked: 16 times
Dream Kudos: 550
My Contributions
not that i recall.
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: What Kind Of Variable
11 Oct, 2002 - 03:32 PM
Post #6

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,355



Thanked: 51 times
Dream Kudos: 25
My Contributions
http://www.sqlconverter.com/excel/docs/mys...l-datatypes.htm

You were right. Thanks.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:07PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month