Re: Setting integers with decimals into a cell
| From: | Paul DuBois | Date: | Wed, 03 Jan 2001 03:06:48 +0000 |
| Subject: | Re: Setting integers with decimals into a cell | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5543@lists.php.net to get a copy of this message | ||
At 4:18 PM +0100 12/31/00, Mattias Johansson wrote:
MUAHAHAHAHA - Hello, grokkers of PHP! I have almost finished my evil new-years-eve project, but I have run into the last problem of them all. You see - I have a variable that usually produces a number like this: 4.17349837364732. I want this to be 4.17 and set it into a MySQL database. How can this be done? I currently have the field in question set to TINYINT, but that does not seem to work. Can anyone please help me with this little problem?No integer type will work, because integers don't have fractional parts. You might want to use something like DECIMAL(10,2), which will store the number with exactly 2 decimal digits. (Make the 10 something else if you want a narrower or wider field.) -- Paul DuBois, paul@snake.net