Jump to content


Photo

Mysql Type For Integers With Decimals


  • Please log in to reply
6 replies to this topic

#1 1internet

1internet

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 20 November 2012 - 03:12 AM

I am trying to store integers that contain decimals. When I select the type INT, it will not allow me to use decimals. What type do I need?
It's just for numbers like 2.4, or 6.3, one decimal place is fine.

#2 Pikachu2000

Pikachu2000

    I hate everything.

  • Staff Alumni
  • 11,382 posts
  • LocationFuture Independent Republic of Texas
  • Age:106

Posted 20 November 2012 - 03:27 AM

Integers, by definition, are not decimal. They are whole numbers. 

"Java" is to "Javascript" about the same as "fun" is to "funeral".

Why $_SERVER['PHP_SELF'] is bad. || Why ORDER BY RAND() is bad || Every problem can be solved with rm -rf *

Random Quote: "

Remember, you're unique. Just like everybody else!


#3 kicken

kicken

    Wiser? Not exactly.

  • Gurus
  • 2,973 posts
  • LocationBonita, FL

Posted 20 November 2012 - 03:47 AM

11.2. Numeric Types


Recycle your old CD's, don't trash them!
Did I help you out? Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#4 1internet

1internet

    Advanced Member

  • Members
  • PipPipPip
  • 137 posts

Posted 20 November 2012 - 09:45 AM

So which one do I need to represent e.g. 5.4?

#5 Muddy_Funster

Muddy_Funster

    Advanced Member

  • Members
  • PipPipPip
  • 3,383 posts

Posted 20 November 2012 - 09:59 AM

Either float or decimal set with 1 decimal place

Please: "This doesn't work..." is not a question.  We're not the government: we don't have anything to view what your doing on your computer.  Help us help you by asking a good question.

 

"Things needed to ask a "good" question:

  • A description of the context of your issue (Optional but can be a huge help in certain circumstances)
  • What is the actual problem (Mandatory)
  • What does the code actually do (Mandatory)
  • What you think the code should do / What you want the code to do (Mandatory)
  • What things have you tried so far (Optional, but missing it out just wastes your time and ours)
  • The actual code as you are running it - minus any personal information like Database Login Credentials (Mandatory - don't just post pseudo, the vast majority of issues are syntax and not logic)
  • As much info about your development environment as you can give - even if it's just letting us know you are using a hosting provider instead of a local install (Optional, but some questions can not be answered without it.)

#6 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 20 November 2012 - 10:01 AM

Follow kicken's link, and read: You'll find out.
Keeping it simple.

#7 fenway

fenway

    MySQL Si-Fu / PHP Resident Alien

  • Staff Alumni
  • 16,199 posts
  • LocationToronto, ON

Posted 21 November 2012 - 03:47 AM

Don't use approximate data types with an exact one will do.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users