php function to create a table is it possible?
Moderator: General Moderators
-
mikesheridan5
- Forum Newbie
- Posts: 7
- Joined: Thu Jun 19, 2003 12:50 pm
- Location: IA
php function to create a table is it possible?
im stuck with a logic blank mind... I am creating a golf tournament type app using php and initially the admin will be able to create a season and when the admin creates a season it will grab all the players in the player table and will put the players into a season table for that particualr season. now my problem is trying to make a efficient database deisgn. my initial thought was to create a function that creates a table for that particualr season and throws whatever palyers there are in the players table into that season. am i losing you yet
is that a bad idea? or am i heading in the right direction to accomplish this task? any help would be greatly appreciated
Yes its possible. Just pass the "CREATE TABLE..." query to the database as you pass any other query.
Whether its a good idea or not can only be determined with more infomration. For instance, why you need a new table, instead of adding a season column to an existing table?
(Using one table per season violates the "Information Principle" as it hides "meaning" from the database system, by embeding it in table names.)
Whether its a good idea or not can only be determined with more infomration. For instance, why you need a new table, instead of adding a season column to an existing table?
(Using one table per season violates the "Information Principle" as it hides "meaning" from the database system, by embeding it in table names.)
-
mikesheridan5
- Forum Newbie
- Posts: 7
- Joined: Thu Jun 19, 2003 12:50 pm
- Location: IA
well ok here let me try to sum it up so i can do this right the first time =0
ok the admin will be able to add/delete players and add a season
i figure id have 2 tables to start with one being the players table with player info and another table Season, i figured i would do it that way so when the admin creates a new season it would make a new table with season info and adding all the players in the player table, reason behind this is when the admin creates a new season the old season will still keep the information regarding that season (player scored and such) while the new season will hold the new season information. (in case there are new players/ or players leave). Now doing it that way i would be able to list the seasons with all the info from that season. but you are right about the information principle.
so what you are suggesting is that when the admin creates a new season that uses a season column that defines that season but how would i add all the players for that season to that table. im confused now =0
thanks, for the reply
ok the admin will be able to add/delete players and add a season
i figure id have 2 tables to start with one being the players table with player info and another table Season, i figured i would do it that way so when the admin creates a new season it would make a new table with season info and adding all the players in the player table, reason behind this is when the admin creates a new season the old season will still keep the information regarding that season (player scored and such) while the new season will hold the new season information. (in case there are new players/ or players leave). Now doing it that way i would be able to list the seasons with all the info from that season. but you are right about the information principle.
so what you are suggesting is that when the admin creates a new season that uses a season column that defines that season but how would i add all the players for that season to that table. im confused now =0
thanks, for the reply
-
mikesheridan5
- Forum Newbie
- Posts: 7
- Joined: Thu Jun 19, 2003 12:50 pm
- Location: IA