mysql - Creating tables on registration in php -


the question not new in way has small twist it. webpage membership page users places bets. idea create new table users(with naming convention table userbet+$userid) bets. user login information handled, goal save bets of user new table. table created when users register. make score counting easier. right or wrong? done in better way? (everything done in php mysql)

user registers -> table bets created

"create table $userid ,id_bet, games, result, points"

and matching table against correct result?

so again questions: way it? creating table userid smart thing do?

edit

the bets 40 matches, makes tables huge columns , rows. should make 40 tables, 1 each games instead? , put users in there?

posting answer due author's request : )

suggested database schema:

table matches:

id |   name   | ---------------  1 |   vs b | 

table user_bets

id | user_id | match_id | points | result | -------------------------------------------  1 |    x    |    1     |    y   |   z    | 

where match_id related on matches.id

user_id = user.id

user_bets 1 table, containing info. no need of separate tables, clear comments it's considered bad practice alter db schema via user input.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -