PHP gevorderde |
|
beste allemaal,
<?
$query1="SELECT * FROM `tacx` WHERE Round='".$round."' AND Dy='".$Dy."' AND league='league' ORDER BY th,Tm,Ts ASC";
//nu worden de gegevens geselecteerd en ze worden gerangschikd op id dus nieuw komt eerst
$sql1=mysql_query($query1) or die (mysql_error());
while ($objj=mysql_fetch_object($sql1)) {
$did = $objj->user;
$Dd = $objj->Dd;
$Dm = $objj->Dm;
$Dy = $objj->Dy;
$Th = $objj->th;
$Tm = $objj->Tm;
$Ts = $objj->Ts;
$uniek = $objj->uniek;
$mph = $objj->mph;
$kph = $objj->kph;
$hcppoints = $objj->hcppoints;
$hcphour = $objj->hcphour;
$hcpminute = $objj->hcpminute;
$hcpsecond = $objj->hcpsecond;
$queryf="SELECT * FROM `tacx` WHERE Round='".$round."' AND Dy='".$Dy."' AND league='league' ORDER BY th,Tm,Ts ASC LIMIT 0, 1";
$sqlf=mysql_query($queryf) or die (mysql_error());
while ($objf=mysql_fetch_object($sqlf)) {
$fTh = $objf->th;
$fTm = $objf->Tm;
$fTs = $objf->Ts;
$fast="$fTh:$fTm:$fTs";
}
$query2="SELECT * FROM `gebruikers` WHERE id='".$did."'";
//nu worden de gegevens geselecteerd en ze worden gerangschikd op id dus nieuw komt eerst
$sql2=mysql_query($query2) or die (mysql_error());
while ($obj=mysql_fetch_object($sql2)) {
$name = $obj->naam;
$country = $obj->country;
?>
<tr>
<td width="5%"><?php echo $i; ?></td>
<td width="13%"><? echo $Dd; ?>-<? echo $Dm; ?>-<? echo $Dy; ?></td>
<td width="10%"><?PHP echo "$name"; ?></td>
<td><p align="center"><img src="<? echo $country ?>" border="0" align="center"></p></td>
<td width="10%"><div align="center"><? echo $Th; ?>:<? echo $Tm; ?>:<? echo $Ts; ?></div></td>
<td><div align="center"><em><?
if (bereken("$Th:$Tm:$Ts")-bereken($ouwe) == bereken($fast))
{
echo "0";
}
else
{
echo bereken("$Th:$Tm:$Ts")-bereken($ouwe);
} ?> s</em></div></td>
<td><div align="center"><em><? $af = bereken($fast);
echo bereken("$Th:$Tm:$Ts")-$af; ?> s</em></div></td>
<td><div align="center"><? echo $mph; ?></div></td>
<td><div align="center"><? echo $kph; ?></div></td>
<td width="10%"><div align="center"><? echo $hcphour; ?>:<? echo $hcpminute; ?>:<? echo $hcpsecond; ?></div></td>
<td width="5%"><div align="center"><?PHP echo $h; ?></div></td>
<td width="5%"><div align="center"><? echo $hcppoints; ?></div></td>
</tr>
<?php
$i++;
$h--;//1 tot 5
$ouwe="$Th:$Tm:$Ts";
}
?>
<?
}
?>
<? $query1="SELECT * FROM `tacx` WHERE Round='".$round."' AND Dy='".$Dy."' AND league='league' ORDER BY th,Tm,Ts ASC"; //nu worden de gegevens geselecteerd en ze worden gerangschikd op id dus nieuw komt eerst $did = $objj->user; $Dd = $objj->Dd; $Dm = $objj->Dm; $Dy = $objj->Dy; $Th = $objj->th; $Tm = $objj->Tm; $Ts = $objj->Ts; $uniek = $objj->uniek; $mph = $objj->mph; $kph = $objj->kph; $hcppoints = $objj->hcppoints; $hcphour = $objj->hcphour; $hcpminute = $objj->hcpminute; $hcpsecond = $objj->hcpsecond; $queryf="SELECT * FROM `tacx` WHERE Round='".$round."' AND Dy='".$Dy."' AND league='league' ORDER BY th,Tm,Ts ASC LIMIT 0, 1"; $fTh = $objf->th; $fTm = $objf->Tm; $fTs = $objf->Ts; $fast="$fTh:$fTm:$fTs"; } $query2="SELECT * FROM `gebruikers` WHERE id='".$did."'"; //nu worden de gegevens geselecteerd en ze worden gerangschikd op id dus nieuw komt eerst $name = $obj->naam; $country = $obj->country; ?> <tr> <td width="5%"> <?php echo $i; ?></td> <td width="13%"> <? echo $Dd; ?>- <? echo $Dm; ?>- <? echo $Dy; ?></td> <td width="10%"> <?PHP echo "$name"; ?></td> <td><p align="center"><img src=" <? echo $country ?>" border="0" align="center"></p></td> <td width="10%"><div align="center"> <? echo $Th; ?>: <? echo $Tm; ?>: <? echo $Ts; ?></div></td> <td><div align="center"><em><? if (bereken("$Th:$Tm:$Ts")-bereken($ouwe) == bereken($fast)) { } else { echo bereken ("$Th:$Tm:$Ts")-bereken ($ouwe); } ?> s</em></div></td> <td><div align="center"><em><? $af = bereken($fast); echo bereken ("$Th:$Tm:$Ts")-$af; ?> s</em></div></td> <td><div align="center"> <? echo $mph; ?></div></td> <td><div align="center"> <? echo $kph; ?></div></td> <td width="10%"><div align="center"> <? echo $hcphour; ?>: <? echo $hcpminute; ?>: <? echo $hcpsecond; ?></div></td> <td width="5%"><div align="center"> <?PHP echo $h; ?></div></td> <td width="5%"><div align="center"> <? echo $hcppoints; ?></div></td> </tr> <?php $i++; $h--;//1 tot 5 $ouwe="$Th:$Tm:$Ts"; } ?> <? } ?>
met dir script haal ik de gegevens uit de database, met de functie $h laat ik de punten geven (steeds 1 minder).
Maar nu wil ik het aantal punten weten wat bij een bepaald persoon hoord ($did = user).
Hoe haal ik dat aantal punten eruit? of is dat niet mogelijk?
|