Jump to content



  • Please log in to reply
1 reply to this topic

#1 chriscloyd

  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts
  • LocationArizona

Posted 11 October 2006 - 03:20 AM

i hvae a script where people can come to my site sign up and either create a team or join a team when an admin hits the button generate schedule i wanna be able to match each team up to 8 other teams and save all the information into my db can someoen help me get started
44 bugs in my java code
44 bugs in my java code
Fix 1 bug, and complie again
122 bugs in my java code

#2 printf

  • Staff Alumni
  • Advanced Member
  • 889 posts

Posted 11 October 2006 - 10:08 AM

Just randomize the teams not including the team you want to create matches for!

SELECT tid, tname FROM teams WHERE tid != some_team_id ORDER BY RAND() LIMIT 8;

Then add those results to a games table to create the games schedule. You can also add more logic to the above query, so you only select teams that are not already playing or that may have already played one another.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users