Page 1 of 1
Arg
Posted: Tue Jan 14, 2003 6:00 pm
by Pocketx
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
);
Posted: Tue Jan 14, 2003 7:49 pm
by evilcoder
well showing us the table wont help, tell us the error please.
Posted: Tue Jan 14, 2003 9:36 pm
by fractalvibes
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.
Posted: Wed Jan 15, 2003 2:48 am
by twigletmac
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
Posted: Wed Jan 15, 2003 10:12 am
by BDKR
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)
);
Maybe it would be easier to store the user information in one field. My table contains these felds
Code: Select all
sesskey varchar(32) primary key
expiry int(11) unsignged
address text
value text
All the data goes into the value field. If there is more than one piece of data, it goes in as a serialized array. This way, the table above is essentially generic and can be used for many different projects. You just have to be consistent with how you map data in and out of the value field.
One more thing. The address field is for storing the IP address of the person that started the session. I IP lock sessions.
Cheers,
BDKR