Dynamic tables
Posted: Sat Oct 15, 2011 9:50 pm
Hi,
i have multiple games which are added by an website admin
each game have many gameypes.
for each gametype stats will differ, i need to keep all stats from each game and each gametype
current i have a different table for each game with specific stats:
others gametype can have different stats fields
like gametype Standard and Capture the flag for example
where capture the flag will keep flags caputured but standard dont
so in conclusion what i need is:
different Games have different stats fields
different gametypes for a game have more different stats fields
what will be best way to get this working for multiple gametypes?
Thanks
i have multiple games which are added by an website admin
each game have many gameypes.
for each gametype stats will differ, i need to keep all stats from each game and each gametype
current i have a different table for each game with specific stats:
that was the first design but it only cover one game with one gametypeCREATE TABLE `stats_css` (
`id` int(10) unsigned NOT NULL,
`reliability` tinyint(3) unsigned NOT NULL DEFAULT '100',
`ragequit` tinyint(3) unsigned NOT NULL DEFAULT '0',
`played` int(10) unsigned NOT NULL DEFAULT '0',
`won` int(10) unsigned NOT NULL DEFAULT '0',
`drawn` int(10) unsigned NOT NULL DEFAULT '0',
`lost` int(10) unsigned NOT NULL DEFAULT '0',
`assists` int(10) unsigned NOT NULL DEFAULT '0',
`kills` int(10) unsigned NOT NULL DEFAULT '0',
`deaths` int(10) unsigned NOT NULL DEFAULT '0',
`roundswon` int(10) unsigned NOT NULL DEFAULT '0',
`roundsdrawn` int(10) unsigned NOT NULL DEFAULT '0',
`roundslost` int(10) unsigned NOT NULL DEFAULT '0',
`headshots` int(10) unsigned NOT NULL DEFAULT '0',
`damagegiven` int(10) unsigned NOT NULL DEFAULT '0',
`damagerecived` int(10) unsigned NOT NULL DEFAULT '0',
`bombsdefused` int(10) unsigned NOT NULL DEFAULT '0',
`bombsplanted` int(10) unsigned NOT NULL DEFAULT '0',
`1man_played` int(10) unsigned NOT NULL DEFAULT '0',
`1man_won` int(10) unsigned NOT NULL DEFAULT '0',
`2man_played` int(10) unsigned NOT NULL DEFAULT '0',
`2man_won` int(10) unsigned NOT NULL DEFAULT '0',
`3man_played` int(10) unsigned NOT NULL DEFAULT '0',
`3man_won` int(10) unsigned NOT NULL DEFAULT '0',
`4man_played` int(10) unsigned NOT NULL DEFAULT '0',
`4man_won` int(10) unsigned NOT NULL DEFAULT '0',
`5man_played` int(10) unsigned NOT NULL DEFAULT '0',
`5man_won` int(10) unsigned NOT NULL DEFAULT '0',
`maps` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
CONSTRAINT `stats_css_ibfk_1` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
others gametype can have different stats fields
like gametype Standard and Capture the flag for example
where capture the flag will keep flags caputured but standard dont
so in conclusion what i need is:
different Games have different stats fields
different gametypes for a game have more different stats fields
what will be best way to get this working for multiple gametypes?
Thanks