SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Default in table blank?

    So I have a table called "member." In it, there are 6 columns: Field, Type, Null, Key, Default, and Extra. In this table, the fields are "id", "username", and "password."

    I understand what all of it is with the exception of column "Default." When I created the fields, the command I used for username and password is the following:
    Code:
    create table member(
    id int(4) not null auto_increment primary key,
    username varchar(65) not null default '',
    password varchar(65) not null default '',
    );
    What is default for? If ID is showing the default as having a value of "NULL", then why isn't username and password also showing that?

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,048
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    I wouldn't recommend allowing default values for the username and password. Seems as if those would be necessary. Default simply means that if a value for the field isn't supplied in the insert statement that the value will default to that value. In this case the value would default to a empty string.

  3. #3
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    I wouldn't recommend allowing default values for the username and password. Seems as if those would be necessary. Default simply means that if a value for the field isn't supplied in the insert statement that the value will default to that value. In this case the value would default to a empty string.
    I see. Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •