Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 91 to 92 of 92
Thread: NCAA Tournament Bracket Script
12-02-2011, 08:21 PM #91
I see you have an id field. Presumably that is the id of the user who filled out the bracket, yes? That is, it is a foreign key to your Users or Members table?
So your tables should look like this:
CREATE TABLE members ( /* or name of your choosing */ memberId INT PRIMARY KEY, memberName varchar(...), ...other fields describing the member... ); CREATE TABLE teams ( teamId INT PRIMARY KEY, teamName varchar(100), seeding INT /* optional */ ); CREATE TABLE picks ( memberId INT REFERENCES members(memerId), bracketSlot varchar(10), int teamId REFERENCES teams(teamId) );
And now the PHP code to insert into that table is trivial:
You simply loop through all the fields in the POST that start with "pick" and insert them, along with the member's id and the team he/she picked, into one record in the PICKS table.An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Users who have thanked Old Pedant for this post:
03-11-2012, 06:57 AM #92
- Join Date
- Mar 2012
- Thanked 0 Times in 0 Posts
Did anyone have a good solution to this? It looks like there were some good ideas, did anyone ever finish it?