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
| <?php
$req_xlaps = mysql_query("SELECT DriverName, VehicleClass, Lap, Sec1, Sec2, Sec3, LapTime FROM xlaps ORDER BY LapTime, DriverName ASC;");
?>
<div align="center">
<h1>Hotlaps <?php echo $Track; ?></h1>
<table width="85%" bgcolor="#0000FF" border="1" id="td1">
<thead>
<tr>
<th width="15%">Pilotes</th>
<th width="15%">Teams / Mods</th>
<th width="10%">Nbr. Tours</th>
<th width="10%">Best Lap</th>
<th width="10%">Différence</th>
<th width="10%">Sect. 1</th>
<th width="10%">Sect. 2</th>
<th width="10%">Sect. 3</th>
</tr>
</thead>
<tbody>
<?php
// couleurs de ligne tr
$trcolor[0] = '#FFEECC';
$trcolor[1] = '#CCCCCC';
// initialisation
$i=0;
$LapTime2 = 0;
// Affichage
while($resultat2 = mysql_fetch_array($req_xlaps))
{
// requete : temps mini 1,2,3
$reqMinSec = mysql_query("SELECT MIN(Sec1) AS minSec1, MIN(Sec2) AS minSec2, MIN(Sec3) AS minSec3 FROM xlaps;") or die (mysql_error());
$res = mysql_num_rows($reqMinSec);
$minSec1 = mysql_result($reqMinSec,0,"minSec1");
$minSec2 = mysql_result($reqMinSec,0,"minSec2");
$minSec3 = mysql_result($reqMinSec,0,"minSec3");
$i=0;
// tant qu'on a des résultats :
while($res!=$i)
{
// temps mini ?
$Sec1color = ($resultat2['Sec1']==$minSec1)? ' color="#00FF00"' : '';
$Sec2color = ($resultat2['Sec2']==$minSec2)? ' color="#00FF00"' : '';
$Sec3color = ($resultat2['Sec3']==$minSec3)? ' color="#00FF00"' : '';
// différence avec le temps précédent
$LapTime = $resultat2['LapTime'];
$LapTime1 = $resultat2['LapTime'];
$diff_LapTime = ($LapTime1 - $LapTime2); // différence
if($LapTime2 == $LapTime1 ){
$diff_LapTime = "00.00.000";
}
$LapTime2 = $LapTime1; // (pour la boucle suivante)
?>
<tr color=<?php echo "$trcolor[($i % 2)]; ?>">
<td><?php echo $resultat2['DriverName']; ?></td>
<td><?php echo $resultat2['VehicleClass']; ?></td>
<td><?php echo $resultat2['Lap']; ?></td>
<td><?php echo formate1_temps($LapTime); ?></td>
<td><?php echo formate1_temps($diff_LapTime); ?></td>
<td<?php echo $Sec1color; ?>><?php echo $resultat2['Sec1']; ?></td>
<td<?php echo $Sec2color; ?>><?php echo $resultat2['Sec2']; ?></td>
<td<?php echo $Sec3color; ?>><?php echo $resultat2['Sec3']; ?></td>
</tr>
<?php
$i++;
}
$i++; // ?????
}
?>
</tbody>
<table> |
Partager