display array problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can anyone help me with this problem please!
the code below shows a football fixture for the entire season , round 1-22 
but this takes up to much space on the webpage (very long page).
Is it possible to display one round at a time so its automatic.
At the moment- each week the admin  closes a round ie: (round 2 closed) so i 
want the page to display round 3 fixtures only for the entire week.
Can a script show the next round after the closed round (if round 1 is 
closed go to next round -2- if thats closed go to next round which is 3, 
until it gets a round thats not closed and shows the results.

The table

FIXTURES

      Field Type Null Default
      id   int(11) No
      round   char(2) No  0
      game   int(11) No  0
      date   text No
      home   text No
      away   text No
      winner   text No
      draw   text No
      closed   char(1) No  0
      comp_id   int(11) No  0
      margin   int(11) No  0






              <table width="100%" border="0" align="left" cellpadding="0" 
cellspacing="0">
                <tr bordercolor="#333333" bgcolor="#999999" class="tdb1">
                  <td align="center" bgcolor="#CCCCCC" 
class="style23"><strong><font color="#000000">Round</font></strong></td>
                  <td align="center" bgcolor="#CCCCCC" 
class="style23"><strong><font color="#000000">Game</font></strong></td>
                  <td align="center" bgcolor="#CCCCCC" 
class="style23"><strong><font color="#000000">Date</font></strong></td>
                  <td align="center" bgcolor="#CCCCCC" 
class="style23"><strong><font color="#000000">Home</font></strong></td>
                  <td width="26%" align="center" bgcolor="#CCCCCC" 
class="style23"><strong><font color="#000000">Away</font></strong></td>
                </tr>
                <?php
    //get fixtures
    $query = mysql_query("SELECT * FROM fixtures WHERE comp_id = $comp_id");
    $c = 0;
    while ($result = mysql_fetch_array($query)) {
       if ($c == 0) { ?>
                <tr class="trb1">
                  <?php } else {  ?>
                <tr class="tdb1">
                  <?php } ?>
                  <td width="13%" align="center" bordercolor="#FFFFFF" 
class="style23"><?php echo $result['round']; ?></td>
                  <td width="12%" align="center" bordercolor="#FFFFFF" 
class="style23"><?php echo $result['game']; ?></td>
                  <td width="28%" align="center" bordercolor="#FFFFFF" 
class="style23"><?php echo $result['date']; ?></td>
                  <td width="21%" align="center" bordercolor="#FFFFFF" 
class="style23"><?php echo $result['home']; ?></td>
                  <td colspan="2" align="center" bordercolor="#FFFFFF" 
class="style23"><?php echo $result['away']; ?></td>
                </tr>
                <?php
     if ($c == 0) {
      $c = 1;
     } else {
      $c = 0;
     }
    }
   ?>
              </table> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux