If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Create new Table - Newbie

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-21-06, 06:38
Chimp8471 Chimp8471 is offline
Registered User
 
Join Date: Mar 2003
Posts: 225
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
Reply With Quote
  #2 (permalink)  
Old 06-21-06, 06:59
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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)
);
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 06-21-06, 07:02
Chimp8471 Chimp8471 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 06-21-06, 17:46
Chimp8471 Chimp8471 is offline
Registered User
 
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!!
Reply With Quote
  #5 (permalink)  
Old 06-21-06, 17:51
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
that looks okay

yes, when you write the INSERT statement, omit the PlayerID column from the statement altogether
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 06-21-06, 18:21
Chimp8471 Chimp8471 is offline
Registered User
 
Join Date: Mar 2003
Posts: 225
excellent many thanks.............. this mysql stuff is easy aint it lol
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On