Invité
Invité n'ayant pas de compte PHPfrance
03 févr. 2006, 20:05
Revenons à nos moutons, j'avais quelques soucis avec ma requête mais c'est arrangé:
<?php require_once('../Connections/kainbuye.php');
$colname_course = "-1";
if (isset($_GET['class'])) {
$colname_course = (get_magic_quotes_gpc()) ? $_GET['class'] : addslashes($_GET['class']);
}
mysql_select_db($database_kainbuye, $kainbuye);
$query_course = "SELECT t1.ID_coureur,
t1.nom,
t1.prenom,
t2.id_categorie,
t2.nom_categorie,
t3.id_club,
t3.nom_cub,
t4.acrho_club_id_club,
t4.acrho_participant_ID_participant,
t4.annee,
t4.dossard,
t4.acrho_categorie_ID_categorie,
t5.id_course,
t5.nom_course,
t5.date,
t5.lieu,
t5.kilometrage,
t5.nbre_part,
t6.ID_classement,
t6.acrho_course_id_course,
t6.ref_dossard,
t6.temps,
t6.moyenne,
t6.place ".
"FROM acrho_participant AS t1,
acrho_categorie AS t2,
acrho_club AS t3,
acrho_changement AS t4,
acrho_course AS t5,
acrho_classement AS t6 ".
"WHERE t5.id_course = ".$colname_course." ".
"AND t4.acrho_participant_ID_participant = t1.ID_coureur ".
"AND t4.acrho_categorie_ID_categorie = t2.id_categorie ".
"AND t4.acrho_club_id_club = t3.id_club ".
"AND t6.acrho_course_id_course = t5.id_course ".
"AND t6.ref_dossard = t4.dossard ".
" ".
"ORDER BY t6.temps ASC";
$course = mysql_query($query_course, $kainbuye) or die(mysql_error());
$row_course = mysql_fetch_assoc($course);
$totalRows_course = mysql_num_rows($course);
?>
Et temporairement mon script
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?php echo $row_course['nom_course']; ?></title>
<link href="../cosmic18.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="540" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="16" height="34"> </td>
<td width="504"> </td>
<td width="20"> </td>
</tr>
<tr>
<td height="38"> </td>
<td valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" class="cosmic18">
<!--DWLayoutTable-->
<tr>
<td><div align="right"><strong>Résultats de la course : </strong></div></td>
<td><?php echo $row_course['nom_course']; ?></td>
<td><div align="right"><strong>Nombre de participants : </strong></div></td>
<td><?php echo $row_course['nbre_part']; ?></td>
</tr>
<tr>
<td><div align="right"><strong>A la date du : </strong></div></td>
<td><?php setlocale (LC_ALL,"fr_FR"); echo strftime("%A %d %B %Y",strtotime($row_course['date'])); ?></td>
<td><div align="right"><strong>Distance : </strong></div></td>
<td><?php echo $row_course['kilometrage']; ?></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="16"></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="114" colspan="3" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" class="cosmic18">
<tr>
<td><div align="center"><strong>Arr.</strong></div></td>
<td><div align="center"><strong>Dossard</strong></div></td>
<td><div align="center"><strong>Nom</strong></div></td>
<td><div align="center"><strong>Prénom</strong></div></td>
<td><div align="center"><strong>Club</strong></div></td>
<td><div align="center"><strong>Catégorie</strong></div></td>
<td><div align="center"><strong>Temps</strong></div></td>
<td><div align="center"><strong>Moy/km</strong></div></td>
<td><div align="center"><strong>Points</strong></div></td>
</tr>
<?php do { ?>
<tr>
<td><div align="right"></div></td>
<td><div align="right"><?php echo $row_course['ref_dossard']; ?></div></td>
<td><div align="right"></div></td>
<td><div align="right"></div></td>
<td><div align="right"></div></td>
<td><div align="right"></div></td>
<td><div align="right"><?php echo $row_course['temps']; ?></div></td>
<td><div align="right"><?php echo $row_course['moyenne']; ?></div></td>
<td><div align="right"></div></td>
</tr>
<?php } while ($row_course = mysql_fetch_assoc($course)); ?>
</table></td>
</tr>
<tr>
<td height="46"> </td>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($course);
?>
Bon, je voudrais afficher le nom du participant, le club, ... comment?
En 2005, il n'y a qu'une seule personne qui posséde le dossard 138 ... moi
Ce dossard se trouve dans la table t6 (acrho_classement) champs (t6.ref_dossard). Grâce à la date (t5.date) que je transforme en année, je pense qu'il y a moyen de faire une correspondance dans la table (t4.annee)?
Cyrano,
Avec mes nouvelles explications, est-ce que ta proposition de code peut fonctionner? Où dois-je l'introduire dans mon script?
Merci