Hello, im trying to create my sessoin and comments tables. But i get errors, what am i doing wrong? Please help
CREATE TABLE session (
id int(14) NOT NULL auto_increment,
sessionid varchar(255) NOT NULL default '',
username varchar(20) NOT NULL default '',
auth int(14) NOT NULL default '0',
userid int(14) NOT NULL default '0',
firstname varchar(50) NOT NULL default '',
lastname varchar(50) NOT NULL default '',
PRIMARY KEY (id)
);
and
CREATE TABLE `comments` (
`id` INT(14) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`newsid` INT NOT NULL
`userid` INT(14) NOT NULL,
`comment` TEXT NOT NULL,
`date` TIMESTAMP NOT NULL
);
Arg
Moderator: General Moderators
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
One comment - shouldn't an Int be 4???? Don't know that in MySql you have to specify size, as that is a given for int, smallint, bigint, etc.
Check out some of the software good for managing databases , such as
WinSQL or Mascon - see http://www.scibit.com/Products/Software ... Mascon.htm
for the latter.
Phil J.
Check out some of the software good for managing databases , such as
WinSQL or Mascon - see http://www.scibit.com/Products/Software ... Mascon.htm
for the latter.
Phil J.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Have you also checked you syntax against that in the manual:
http://www.mysql.com/doc/en/CREATE_TABLE.html
As evilcoder said, it will also help us to help you if you tell us what the error message is.
Mac
http://www.mysql.com/doc/en/CREATE_TABLE.html
As evilcoder said, it will also help us to help you if you tell us what the error message is.
Mac
Maybe it would be easier to store the user information in one field. My table contains these feldsCREATE TABLE session (
id int(14) NOT NULL auto_increment,
sessionid varchar(255) NOT NULL default '',
username varchar(20) NOT NULL default '',
auth int(14) NOT NULL default '0',
userid int(14) NOT NULL default '0',
firstname varchar(50) NOT NULL default '',
lastname varchar(50) NOT NULL default '',
PRIMARY KEY (id)
);
Code: Select all
sesskey varchar(32) primary key
expiry int(11) unsignged
address text
value textOne more thing. The address field is for storing the IP address of the person that started the session. I IP lock sessions.
Cheers,
BDKR