ptmuldoon
02-15-2008, 10:58 PM
I'm creating a table to eventually use for chats on my site. The table is to store the information all ALL of the individual chats on the site.
Each chat will have it own Game ID(GID) and name. And then each new input into the chat will create a new row in the table. I want the TextID (tid) to auto increment each time a new entry is made for that specific Game ID. Is the below table creation correct? Will it auto increment the TID correctly?
Also is there a way to have the table stored by GID and then by TID to make browsing the table easier when needed?
ie,
gid tid
1 1
1 2
1 3
4 1
4 2
4 3
CREATE TABLE `risk_game_chat` (
`gid` mediumint(7) NOT NULL,
`gname` text NOT NULL,
`tid` mediumint(7) NOT NULL auto_increment,
`time` bigint(11) NOT NULL default '0',
`player` tinytext NOT NULL,
`text` text NOT NULL,
`url` text NOT NULL,
UNIQUE KEY `tid` (`tid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
Each chat will have it own Game ID(GID) and name. And then each new input into the chat will create a new row in the table. I want the TextID (tid) to auto increment each time a new entry is made for that specific Game ID. Is the below table creation correct? Will it auto increment the TID correctly?
Also is there a way to have the table stored by GID and then by TID to make browsing the table easier when needed?
ie,
gid tid
1 1
1 2
1 3
4 1
4 2
4 3
CREATE TABLE `risk_game_chat` (
`gid` mediumint(7) NOT NULL,
`gname` text NOT NULL,
`tid` mediumint(7) NOT NULL auto_increment,
`time` bigint(11) NOT NULL default '0',
`player` tinytext NOT NULL,
`text` text NOT NULL,
`url` text NOT NULL,
UNIQUE KEY `tid` (`tid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;