MoFish Posted April 28, 2007 Share Posted April 28, 2007 Hello. I'm currently trying to make a poker league whats seem to be going well. I have populated a table with the league results, but would like 1st position in gold, 2nd in silver and 3rd in bronze. These will be the first three rows of the table, as the data has already been arranged in the correct order. I'm a little unsure how to go about doing this, and wondered if anyone could point me in the right direction. Below is the code used for the population of my table: thanks alot, hopefully someone can help me out <?php mysql_select_db($database_ReportConnection, $ReportConnection); $query_SelectAllLeague = "SELECT * FROM league_table ORDER BY LeaguePoints DESC , league_table.LeagueGames DESC"; $SelectAllLeague = mysql_query($query_SelectAllLeague, $ReportConnection) or die(mysql_error()); $row_SelectAllLeague = mysql_fetch_assoc($SelectAllLeague); $totalRows_SelectAllLeague = mysql_num_rows($SelectAllLeague); ?> <table border="1" cellpadding="3" cellspacing="3"> <tr> <td>Icon</td> <td>Player</td> <td>Spent</td> <td>Ballance</td> <td>No.First</td> <td>No.Second</td> <td>No.Third</td> <td>Games</td> <td>First %</td> <td>Second %</td> <td>Third %</td> <td>WoodenSpoon</td> <td>Points</td> </tr> <?php do { ?> <tr> <td>º</td> <td><?php echo $row_SelectAllLeague['LeaguePlayer']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueBuyIn']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueOverall']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueFirst']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueSecond']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueThird']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueGames']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueFirstPercent']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueSecondPercent']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueThirdPercent']; ?></td> <td><?php echo $row_SelectAllLeague['LeagueWoodenSpoon']; ?></td> <td><?php echo $row_SelectAllLeague['LeaguePoints']; ?></td> </tr> <?php } while ($row_SelectAllLeague = mysql_fetch_assoc($SelectAllLeague)); ?> </table> Quote Link to comment Share on other sites More sharing options...
ignace Posted April 28, 2007 Share Posted April 28, 2007 // The below code gives you the possibility to colour more then 3 rows // for example if you would like also to colour the fourth and fifth, you // only have to add 2 more colors to the $colors array! // $colors = array('#FFBB00', '#9CB400', '#9C9C9C'); do { if (isset($colors)) { $color = array_shift($colors); if (is_null($color)) { unset($colors); } } else { $color = '#ffffff'; } // color row // <tr bgcolor= $color; } Quote Link to comment Share on other sites More sharing options...
MoFish Posted April 28, 2007 Author Share Posted April 28, 2007 thanks for the reply. i tryed the following. can't seem to get anywhere with it. am i doing it correct below? Parse error: syntax error, unexpected ';', expecting T_WHILE in league.php on line 49 <?php $colors = array('#FFBB00', '#9CB400', '#9C9C9C'); do { if (isset($colors)) { $color = array_shift($colors); if (is_null($color)) { unset($colors); } } else { $color = '#ffffff'; } echo "<tr bgcolor=' . $color . '>#</tr>"; } ?> 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.