Jump to content

Recommended Posts

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?

 

Link to comment
https://forums.phpfreaks.com/topic/56973-data-types-which-should-i-be-using/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.