crocough Posted June 24, 2007 Share Posted June 24, 2007 Hi there, I'm new to both PHP and MySQL and for my first project I'm creating a wages system. And these are the necessary fields that need to be filled. 1. Name, 2. Hourly rate, for e.g. 8.50 (£8.50p) 3. Deliveries (how many deliveries made, for e.g. 10) 4. Bonus (for example £20 if 10 or more deliveries are achieved) 5. Hour in (0-24) 6. Minute in (0-60) 7. Hour out (0-24) 8. Minute out (0-60) 9. Total (this will output how much money they have earned) From having a glance over data types I have selected the following : 1. VARCHAR 2. DECIMAL 3. SMALLINT 4. SMALLINT 5. TIME 6. TIME 7. TIME 8. TIME 9. DECIMAL Could anyone verify if this is anywhere close to being correct? Quote Link to comment https://forums.phpfreaks.com/topic/56973-data-types-which-should-i-be-using/ Share on other sites More sharing options...
btherl Posted June 25, 2007 Share Posted June 25, 2007 I wouldn't limit yourself with a smallint for the bonus, since it's a monetary value. I can't believe there will be many rows in this table, so saving a few bytes of space is not worth sacrifing expressiveness. The rest looks fine.. it's a little odd to seperate hour and minute, but you can always add them together if you want. FYI, there are functions in mysql to extract the hour and minute part from a time value: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/56973-data-types-which-should-i-be-using/#findComment-281663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.