paulman888888 Posted January 1, 2009 Share Posted January 1, 2009 hi; I am trying to create a simple tournament script. The amount of people who are in the tournamnt will change all the time so i cant use a fixed script. I no i need to use lots of loops but i dont no where. THIS IS THE PROBLEM! how do the loops join together. I think i need to do something like this; Get the amount of player Get the each name of a player and store in an array Then am stuck... Pair each one with another then pair again but the same person and so on untill all have played all! Please Help me Thankyou in advance Paul Hutchinson Quote Link to comment Share on other sites More sharing options...
gaza165 Posted January 1, 2009 Share Posted January 1, 2009 Not quite sure what your aiming for? are you looking for a wat to update players on the torunament without having to send a post or refresh the page each time?? Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted January 1, 2009 Share Posted January 1, 2009 Instead of describing how you think you should do, how about describing what you want the result to be? Are you just looking to get a list of people and their opponents? This is essentially a many-to-many relationship for which you'll need an intermediary table to store relations. Sort of like this: SELECT a.player_name player1, b.player_name player2 FROM player_opponents x INNER JOIN players a ON x.player_id = a.player_id INNER JOIN players b ON x.player_id = b.player_id; The player_opponents table just has two integer fields referencing a row in the players table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.