Jump to content

[SOLVED] insert and retreive decimal figures.


richrock

Recommended Posts

Am I doing this right?  (Obviously not, but I need to know if I'm heading in the right direction...)  ???

 

I set up a mysql table :

 

+-------------+---------+------+-----+---------+----------------+
| Field       | Type    | Null | Key | Default | Extra          |
+-------------+---------+------+-----+---------+----------------+
| id          | int(11) | NO   | PRI | NULL    | auto_increment |
| vat         | int(11) | NO   |     | NULL    |                |
| vat_date    | date    | NO   |     | NULL    |                |
| export      | int(11) | NO   |     | NULL    |                |
| export_date | date    | NO   |     | NULL    |                |
| visa        | int(11) | NO   |     | NULL    |                |
| visa_date   | date    | NO   |     | NULL    |                |
| amex        | int(11) | NO   |     | NULL    |                |
| amex_date   | date    | NO   |     | NULL    |                |
| photo       | int(11) | NO   |     | NULL    |                |
| photo_date  | date    | NO   |     | NULL    |                |
| illust      | int(11) | NO   |     | NULL    |                |
| illust_date | date    | NO   |     | NULL    |                |
+-------------+---------+------+-----+---------+----------------+
13 rows in set (0.00 sec)

 

So I can set up variables for tax rates, fixed charges, and store the date with each so that any invoices/statements for accounts can be calculated against dates they were generated...  That's for another day  ;)

 

However, when I inserted some test data via phpmyadmin, it rounded up 17.5 to 18 for the VAT, and 2.5 to 3 for the visa rows.

 

I'm not sure how to fix this, so any help would be greatly appreciated.  Also, I just copied the INT(11) from other tables but research shows that I could use other values, so could I lower the INT value?  I don't mind re-doing the table, but need to keep dates on each numerical value independently.

 

TIA

 

Rich

I am not completely sure about this but I believe that the int type only stores whole numbers. I think that you will need to use either double or decimal. You may want to do a search on either of those to find out which one would best suite your application.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.