big confusion

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
sunil.23413
Forum Newbie
Posts: 6
Joined: Fri Jun 20, 2008 1:48 am

big confusion

Post by sunil.23413 »

how to make a table having different fields to keep record of differnt users on different dates?
i m making a table having three field chest,waist and arm.now i m to add two more fields users and date, so that i can enter the records of different users on different dates....
User avatar
deeessay
Forum Commoner
Posts: 55
Joined: Sat May 24, 2008 1:02 am

Re: big confusion

Post by deeessay »

I've read your post twice... and I think I get what you mean....okay so i think this is what you should do:

first let us call the table where the fields chest, waist and arm are located and let's call that table measurements

in the measurements table, let's add these fields:

1. measument_id - this will be the primary key for this table, you can set this to auto-increment if you wish.
2. user_id - as its name implies, this holds the unique identifier for the user


To solve your problem, let's create a new table and let's call it measurement_date

In measurement_date, let's add these fields:

1. mdate_id - the primary key
2. measurement_id - this will have the same value as the measurement_id in the table measurement
3. mdate - the date when the measurement was taken


So you see, if you want to get all measurements of a particular user, you can get all of his/her measurements in the measurement table by querying the measurement_id and then you can use that measurement_id to find out when the measurement was taken in the measurement_date table.


I know I probably bored you with my reply but I do hope this answered your question. Good day!
sunil.23413
Forum Newbie
Posts: 6
Joined: Fri Jun 20, 2008 1:48 am

Re: big confusion

Post by sunil.23413 »

thanks for helping ...i have understood ur reply and will apply it soon....
Post Reply