Bonjour,

cela fait un moment que cherche récupérer la valeur maximun d'un champ dans un table mysql et ensuite faire un test

ex:

Si champ 'points' = à la valeur maximum de 'points' alors appliquer la class

voici mon code. J'essaie de faire ce test à la ligne 80 de mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
include 'connexion.php';
 
// Le nom de notre table
$tablename = 'mysql_licence_joueur';
 
// Tri sur colonne
$tri_autorises = array('id','joueur','equipe','assiste','buts','points','penalites','points','nbre_match');
$order_by = in_array($_GET['order'],$tri_autorises) ? $_GET['order'] : 'joueur';
 
 
// Sens du tri
$order_dir = isset($_GET['inverse']) ? 'DESC' : 'ASC';
$filtre = $_GET['nom_equipe'];
 
$var=0; 
 
// Préparation de la requête
 
 
 
 
 
$sql =('SELECT * FROM '.$tablename.' where equipe ="'.$_GET["nom_equipe"].'" and nbre_match <> 0
ORDER BY '.$order_by.' '.$order_dir.'');
 
$result = mysql_query($sql);
 
 
// Notre fonction qui affiche les liens
function sort_link($text, $order=false)
{
    global $order_by, $order_dir;
 
    if(!$order)
        $order = $text;
 
    $link = '<a href="index.php?option=com_content&view=article&id=23&nom_equipe='.$_GET["nom_equipe"].'&order=' . $order;
    if($order_by==$order && $order_dir=='ASC')
        $link .= '&inverse=true';
    $link .= '"';
    if($order_by==$order && $order_dir=='ASC')
        $link .= ' class="order_asc"';
    elseif($order_by==$order && $order_dir=='DESC')
        $link .= ' class="order_desc"';
    $link .= '>' . $text . '</a>';
 
    return $link;
}
 
 
// Affichage
?>
<div id="texte_haut_article" class="titre_article">
<?php echo $_GET["nom_equipe"]?>
</div>
<table width="690" bgcolor="<?php echo $bgc;?>" cellspacing="0" align="left" class="semi-transparent-calendrier">
        <tr>
        <td width="10"class="info"></th>
        <td width="18"class="info"></th>
        <th width="200" class="info">Joueurs <?php echo sort_link('<img src="img/asc.png" border="0" title="Tri croissant">', 'joueur') ?> <a href="index.php?option=com_content&view=article&id=23&nom_equipe=<?php echo $_GET["nom_equipe"]?>&order=joueur&inverse=true"><img src="img/desc.png" title="Tri décroissant"/></th>
 
        <th width="110" class="info">Assistes <?php echo sort_link('<img src="../img/asc.png" border="0" title="Tri croissant">', 'assiste') ?> <a href="index.php?option=com_content&view=article&id=23&nom_equipe=<?php echo $_GET["nom_equipe"]?>&order=assiste&inverse=true"><img src="img/desc.png" title="Tri décroissant"/></th>
 
        <th width="90" class="info">Buts <?php echo sort_link('<img src="img/asc.png" border="0" title="Tri croissant">', 'buts') ?> <a href="index.php?option=com_content&view=article&id=23&nom_equipe=<?php echo $_GET["nom_equipe"]?>&order=buts&inverse=true"><img src="img/desc.png" title="Tri décroissant"/></th>
 
        <th width="90" class="info">Pts <?php echo sort_link('<img src="img/asc.png" border="0" title="Tri croissant">', 'points') ?> <a href="index.php?option=com_content&view=article&id=23&nom_equipe=<?php echo $_GET["nom_equipe"]?>&order=points&inverse=true"><img src="img/desc.png" title="Tri décroissant"/></th>
 
        <th width="110" class="info">Penalités <?php echo sort_link('<img src="img/asc.png" border="0" title="Tri croissant">', 'penalites') ?> <a href="index.php?option=com_content&view=article&id=23&nom_equipe=<?php echo $_GET["nom_equipe"]?>&order=penalites&inverse=true"><img src="img/desc.png" title="Tri décroissant"/></th>
 
        <th width="90" class="info">*Nbm <?php echo sort_link('<img src="img/asc.png" border="0" title="Tri croissant">', 'nbre_match') ?> <a href="index.php?option=com_content&view=article&id=23&nom_equipe=<?php echo $_GET["nom_equipe"]?>&order=nbre_match&inverse=true"><img src="img/desc.png" title="Tri décroissant"/></th>
    </tr>
 
<?php 
 
 
while( $row=mysql_fetch_assoc($result) )
{
        $nb_classement++;//commence à compter depuis 1
if ($row['points']== valeur maximum du champ points) 
{ 
echo '<tr class="degrader">';
 
}else
 
if ($var==0) 
{ 
echo '<tr bgcolor="#333333">';
$var=1; 
}else{ 
echo '<tr bgcolor="#666666">';
$var=0; 
} 
 
    echo '<td></td>';
    echo '<td>'.$nb_classement.'.</td>';
    echo '<td><a href="index.php?option=com_content&view=article&id=75&id_joueur='.$row['id_joueur'].'" title="Voir les détails"/a>'.$row['joueur'].'</a></td>';
 
    echo '<td>'.$row['assiste'].'</td>';
    echo '<td>'.$row['buts'].'</td>';
    echo '<td>'.$row['points'].'</td>';
    echo '<td>'.$row['penalites'].'</td>';
    echo '<td>'.$row['nbre_match'].'</td>';
 
    }
    echo '</tr>'."\n";
 
 
echo '</table>'."\n"; 
echo '<div id="bas_page_statistiques">';
echo '*Nbm=(Nombre de matchs joué)';
echo '</div>';
 
?>
Merci pour votre aide