I am still a noob using PHP, but I am trying to teach myself as much as I can before asking for help.
Well, I am stuck....
I have tried almost every method out there, and still cant get it to work in my table...
I have been trying to alternate row classes in order to display alternating backgrounds in my PHP table.
Here is the code:
Code: Select all
<table class="stats">
<thead>
<tr>
<th class="header text_left">Nom</th>
<th class="header text_right width">#</th>
<th class="header text_right width">J</th>
<th class="header text_right width"><a href='statistiques.php?buts=1'>B</a></th>
<th class="header text_right width"><a href='statistiques.php?assista=1'>A</a></th>
<th class="header text_right width">PTS</th>
<th class="header text_right width"><a href='statistiques.php?penal=1'>Pen</a></th>
<th class="header text_right width">Pts<sup>%</sup></th>
</tr>
</thead>
<?php
//boucle d'affichage SQL Stats
if($_GET['buts']==1)
{
$reponse = mysql_query("SELECT * FROM joueur WHERE type='a' OR type='d' OR type='g' ORDER BY but DESC");
}
elseif(isset($_GET['assista'])==1)
{
$reponse = mysql_query("SELECT * FROM joueur WHERE type='a' OR type='d' OR type='g' ORDER BY assist DESC");
}
elseif(isset($_GET['penal'])==1)
{
$reponse = mysql_query("SELECT * FROM joueur WHERE type='a' OR type='d' OR type='g' ORDER BY penal DESC");
}
else
{
$reponse = mysql_query("SELECT * FROM joueur WHERE type='a' OR type='d' OR type='g' ORDER BY nom DESC");
}
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<tr>
<td class="text_left bold">
<a href="player.php?id=<?php echo $donnees['id'];?>">
<?php echo $donnees['nom'];?>, <?php echo $donnees['prenom'];?>
</a>
</td>
<td class="text_right">
<?php echo $donnees['numero'];?> #
</td>
<td class="text_right green">
<?php echo $donnees['matches'];?>
</td>
<td class="text_right yellow">
<?php echo $donnees['but'];?>
</td>
<td class="text_right blue">
<?php echo $donnees['assist'];?>
</td>
<td class="text_right">
<?php
$points=$donnees['assist']+$donnees['but'];
echo $points; ?>
</td>
<td class="text_right">
<?php echo $donnees['penal'];?>
</td>
<td class='td_joueur'>
<?php
if($points!='0')
{
$moyenne=$points/$donnees['matches'];
echo $moyenne;
}
else
{
echo '0';
}
?>
</td>
</tr>
<?php
} //fin de la boucle statistiques
?>
</table>Thanks guys!!
Gino