Setting up numerical fields for my billing table

What type of fields are best for the following:

dollar values with decimals
simple numbers that will typically range from 0 to 30 but never exceed 50.

smallint and mediumint don’t seem big enough.

Thanks

depending on what database you are using there is

dollar amounts:
DECIMAL(M,D) - Oracle and MySQL, NUMBER(M,D) - Oracle, NUMERIC (M,D) - MySQL, FLOAT, and a couple others. Look here - http://dev.mysql.com/doc/mysql/en/Numeric_types.html - for a full listing. The type you choose should take into account what you will do with the data. (suggest DECIMAL - but with caution)

small numbers:
unsigned tinyint, smallint

if they are two attributes (columns) then they can each have there own data type.

Oops sorry!! I’m using MYSQL. I’ve got the basic table set up, but those two fields I wasn’t sure of. Makes sense to go decimal (or I guess float) for the dollar values, but I will check that link for the other numbers field. All the other fields are varchar.

The first thing I’m going to try and do after that is to work on the form layout, then add in the script bit by bit. I figure that way I’ll know what all my input field names will be and then as I add them and test them it will be bug tested as I go.

I’m kind of working in the dark a bit but thats ok. If I fail I will at least learn what not to do.

check out http://www.codewalkers.com in the tutorials/basics section there is 2 tutorials you should check out (Minimum). Working with Forms and Form validation…

Sponsor our Newsletter | Privacy Policy | Terms of Service