Mettre en gras le plus grand chiffre d'une colonne

Eléphanteau du PHP | 34 Messages

09 oct. 2005, 17:49

Bjs,

Je voudrais mettre ne GRAS le plus grand chiffre.

Voici ma requette :
$result = $db->sql_query("SELECT t1.user, t1.total, t1.m$mc, t1.m$mb, t1.m$ma, t1.console, t2.team
FROM class_tocard2_2005 AS t1
LEFT JOIN fiche_pilote AS t2 ON t1.user = t2.user
WHERE console='PC'
ORDER BY total DESC LIMIT 0,10");
echo "<table CELLPADDING=\"1\" CELLSPACING=\"0\"><tr><td></td><td>Pilote</td><td></td><td>M". $mc ."</td><td>M". $mb ."</td><td>M". $ma ."</td><td>tot</td></tr>";
$a = 1;
while($data = mysql_fetch_array($result))
    {
include("team.php");
$b = $a++;
    echo "<tr><td><B>$b</B>. </td>";
    echo '<td><a href="modules.php?name=Fiche_Pilote&file=fiche&user2='. $data['user'] .'">'. $data['user'] .'</a></td><td>'. $data['team'] .'</td><td>'. $data['m'.$mc.''] .'</td><td>'. $data['m'.$mb.''] .'</td><td>'. $data['m'.$ma.''] .'</td><td>'. $data['total'] .' </td></tr>';
    }
echo '</table><p><center><b>Classement Team 2005</b>
voici ensuite ce que me donne cette requette

Code : Tout sélectionner

1. sebf 1 4 5 90 2. Speedracer 3 1 4 73 3. drgg77 4 2 1 64 4. denca052 60 5. bruce 50 6. seatracing 30 7. KrysTOFF 2 3 3 30
ce que je voudrais, c'est donc, pour chaque colonne, d'avoir le plus gros chiffre en gras (1er colonne, le 4 - 2em colonne le 4 et 3em colonne le 5)

Comment faire ca ?

Merci d'avance :wink:
http://www.racegamers.com
Championnat offline sur tous les jeux de sport mecanique

Mammouth du PHP | 19672 Messages

09 oct. 2005, 18:19

Essaye comme ça:
<?php
$result = $db->sql_query("SELECT t1.user, t1.total, t1.m". $mc .", t1.m". $mb .", t1.m". $ma .", t1.console, t2.team
FROM class_tocard2_2005 AS t1
LEFT JOIN fiche_pilote AS t2 ON t1.user = t2.user
WHERE console='PC'
ORDER BY total DESC LIMIT 0,10");
?>
<table CELLPADDING="1" CELLSPACING="0">
  <tr>
    <td>&nbsp;</td>
    <td>Pilote</td>
    <td>&nbsp;</td>
    <td>M<?php echo($mc); ?></td>
    <td>M<?php echo($mb); ?></td>
    <td>M<?php echo($ma); ?></td>
    <td>tot</td>
  </tr>
<?php
$a = 1;
while($data = mysql_fetch_array($result))
{
    include("team.php");
    $b = $a++;
    $mma = ($data['m'.$ma] > $data['m'.$mb] && $data['m'.$ma] > $data['m'.$mc]) ? "<strong>". $data['m'.$ma] ."</strong>" : $data['m'.$ma];
    $mmb = ($data['m'.$mb] > $data['m'.$ma] && $data['m'.$mb] > $data['m'.$mc]) ? "<strong>". $data['m'.$mb] ."</strong>" : $data['m'.$mb];
    $mmc = ($data['m'.$mc] > $data['m'.$ma] && $data['m'.$mc] > $data['m'.$mb]) ? "<strong>". $data['m'.$mc] ."</strong>" : $data['m'.$mc];
?>
  <tr>
    <td><B><?php echo($b); ?></B>. </td>
    <td><a href="modules.php?name=Fiche_Pilote&file=fiche&user2=<?php echo($data['user']); ?>"><?php echo($data['user']); ?></a></td>
    <td><?php echo($data['team']); ?></td>
    <td><?php echo($$mmc); ?></td>
    <td><?php echo($$mmb); ?></td>
    <td><?php echo($$mma); ?></td>
    <td><?php echo($data['total']); ?></td>
  </tr>
<?php
}
?>
</table>
<p><center><b>Classement Team 2005</b>
Codez en pensant que celui qui maintiendra votre code est un psychopathe qui connait votre adresse :axe:

Eléphanteau du PHP | 34 Messages

09 oct. 2005, 18:43

heu, non

il ne faut pas comparer mma avec mmb et mmc (car ce sont 3 manches differentes)
Ce que je voudrais, c'est le plus gros chiffre en gras de ma, idem pour mb et mc :oops:
http://www.racegamers.com
Championnat offline sur tous les jeux de sport mecanique

Mammouth du PHP | 19672 Messages

09 oct. 2005, 18:56

Ok, là, ça pose un autre problème: il va falloir faire une requête préliminaire pour récupérer ces trois valeurs là et ensuite quand tu génèreras ton tableau, il faudra faire une comparaison avec ces valeurs pour mettre ou non en gras.

Je te laisse cogiter un peu sur le sujet.
Codez en pensant que celui qui maintiendra votre code est un psychopathe qui connait votre adresse :axe: