Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2003
    Posts
    225

    Unanswered: Create new Table - Newbie

    I want to store some data in a MYSQL table for my football club, but am not sure which field types to set the table up with.

    Can anyone offer me some advice please

    Field Names:

    PlayerID - Autonumber
    Forename
    Surname
    DOB
    RegNo
    Photo (image to be stored on my webserver, so this would be a link to that photo's Path)
    Nickname
    Comments

    Thanks in advance

    Andy

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    create table Players
    ( PlayerID  integer     not null primary key auto_increment
    , Forename  varchar(50) 
    , Surname   varchar(50) not null
    , DOB       date
    , RegNo     tinyint
    , Photo     varchar(255)
    , Nickname  varchar(50)
    , Comments  varchar(255)
    );
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2003
    Posts
    225
    many thanks for that, i just need to work out how to get the php code to read from it now

    thanks

    Andy

  4. #4
    Join Date
    Mar 2003
    Posts
    225
    am i right in thinking that should i want to add a few new fields to this the code should be:

    create table Players
    ( PlayerID integer not null primary key auto_increment
    , Forename varchar(50)
    , Surname varchar(50) not null
    , DOB date
    , RegNo tinyint
    , Photo varchar(255)
    , Nickname varchar(50)
    , Comments varchar(255)
    , Position varchar(50)
    , GamesPlayed tinyint
    , GoalsScored tinyint
    );

    The new fields being

    , Position varchar(50)
    , GamesPlayed tinyint
    , GoalsScored tinyint

    also when i insert a new record via a form do i have to include the PlayerID field or just start from the Forename field? i think the PlayerID number is created automatically

    please advise!!

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    that looks okay

    yes, when you write the INSERT statement, omit the PlayerID column from the statement altogether
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Mar 2003
    Posts
    225
    excellent many thanks.............. this mysql stuff is easy aint it lol

Posting Permissions

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