NameSilo

Random script issues

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch

Delusion

New Member
Impact
0
Hello,

Generally, I'll describe what was my idea at first.

I've been trying to make a script for my school (football, 1vs1) that will make me random teams selection.

The main idea about it, I got 11 teams, The random I was trying to do:

Each team should play 20 games in a season, with each team playing each other TWICE at a season.

I've tried to make this using a 'FOR' loops but I've got double games and alot of mess.

Here's my try:
PHP:
<?
echo "<table>";
 for($i=1 , $c=1 , $b=4 , $a=1 ; $i <= 220 ; $i++ , $c+=1 , $b++, $a++) {

   echo "<tr>";
     echo "<td width='100' align='left'>$i</td>";
     echo "<td>team $a</td>";
     echo "<td>vs.</td>";
     echo "<td>team $b</td>";
   echo "</tr>";

  // Storing the DATA at MySQL irrelevant now

   if ($a >= "11") { $a = "0"; }
   if ($b >= "11") { $b = "0"; }
   if ($c >= "6") { $c = "0"; echo "<tr><td colspan='5'><hr></td></tr>"; }
 }

echo "</table>";

I've spent alot of time trying to make it work and failed :(
I hope someone around will be able helping me!

Thanks in advnace.
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back