Solved

Show decimals with MySQL database

Posted on 2013-01-02
1
261 Views
Last Modified: 2013-01-07
I currently have a price field set up as INT (11).

This price field was to show annual salaries  ie 35,000, 25,000 etc but now I need to include hourly rates such as 6.19. If you 6.19 at the moment it just shows as 6.

So I now need to show decimal values can this be done keeping the INT format? or do I need to change the structure?

db
0
Comment
Question by:BrighteyesDesign
1 Comment
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 total points
ID: 38736708
Integer data types are for whole numbers only.

If you need decimal values, you'll need to modify your structure to a data type that supports decimal values (I believe that's DECIMAL in mySQL, but it might be FLOAT, check the documentation)

EDIT: Here's the documentation links for MySQL Fixed/Floating Point numeric values:

http://dev.mysql.com/doc/refman/5.0/en//numeric-types.html#integer-types
http://dev.mysql.com/doc/refman/5.0/en//fixed-point-types.html
http://dev.mysql.com/doc/refman/5.0/en//floating-point-types.html
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question