hi, im making a register page and i would like to know what i should put the different things the user submits into my database.
for example:
these are the things the user submits
First Name: (should this be Char or VarChar or another one?)
Last Name: (same as first name)
Password: (no clue)
Confirm Password: (no clue)
Email Address: (same as first name)
Confirm Email Address:(same as first name)
Sex: (what should this be if its a drop down bar thing?)
Date of Birth: (should this be date time or time stamp or another one? and how can i make it so the user has to imput it as mm/dd/yyyy?)
City: (same as first name)
Country: (same as sex)
thanks for the help,
matt
types?
Moderator: General Moderators
1st question: Why on earth would you want to save *-confirm fields in the database?
Types:
First Name: varchar (50)
Last Name: varchar (75)
Password: varchar (32) if you want MD5 encryption, varchar (40) for SHA1 [for any other encryption use appropriate size]
Confirm Password: [forget about this column]
Email Address: varchar (100)
Confirm Email Address: [forget about this column]
Sex: int (1) [an int with size 1 which can be used as a boolean or for values 0,1,2 equalling undisclosed, male, female for instance]
Date of Birth: int (10) [standard Unix Timestamp]
City: varchar (150) [just to be sure of extra long names]
Country: enum, int (3) or other depending on implementation
For info on the types, check the MySQL Manual.
Types:
First Name: varchar (50)
Last Name: varchar (75)
Password: varchar (32) if you want MD5 encryption, varchar (40) for SHA1 [for any other encryption use appropriate size]
Confirm Password: [forget about this column]
Email Address: varchar (100)
Confirm Email Address: [forget about this column]
Sex: int (1) [an int with size 1 which can be used as a boolean or for values 0,1,2 equalling undisclosed, male, female for instance]
Date of Birth: int (10) [standard Unix Timestamp]
City: varchar (150) [just to be sure of extra long names]
Country: enum, int (3) or other depending on implementation
For info on the types, check the MySQL Manual.
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Matter of taste, I guess. I'd use an int because it's more comfortable somehow.jayshields wrote:I agree on the most part, but a CHAR (1) would be better for Sex, then it could be M or F.
Agreed, was thinking of dates in general.jayshields wrote:Also, a DATETIME (or similar date storage type if time is irrelevant - which it probably will be with a DOB) would be better than a VARCHAR (10) for the DOB.