le 18/07/2006 à 21:37
Problème avec la clause UNION
Ok merci pour la réponse je vais essayer
<?$connection = mysql_connect ($host, $user, $password)
or die ("Connection au serveur impossible.");
$db = mysql_select_db ($database, $connection)
or die ("connection à la base de données imposible.");
$req = "(SELECT * FROM 125serie1 ORDER BY manche1+manche2, manche2 LIMIT 8) UNION ALL (SELECT * FROM 125serie2 ORDER BY manche1+manche2, manche2 LIMIT 8) ORDER BY manche1+manche2, manche2";
$resultat = mysql_query ($req)
or die ("Exécution de la requête impossible.");
$i=0;
echo "<table width='730' border='1' align='center' cellspacing='0' bordercolor='#FF6600' bgcolor='#CCCCCC'>
<tr>n
<td><div align='center'><strong>Pos.</strong></div></td>n
<td><div align='center'><strong>Pilote</strong></div></td>n
<td><div align='center'><strong>N° de course </strong></div></td>n
<td><div align='center'><strong>Motoclub </strong></div></td>n
<td><div align='center'><strong>Manche2 </strong></div></td>n
<td><div align='center'><strong>Manche2 </strong></div></td>n
<td><div align='center'><strong>Cumul </strong></div></td>n
</tr>n";
while($row = mysql_fetch_row($resultat)){
$i++;
$nom = $row[0];
$numero = $row[1];
$motoclub = $row[2];
$manche1 = $row[3];
$manche2 = $row [4];
$cumul = $manche1 + $manche2;
/* Affichage du tableau */
echo "
<tr>n
<td width='50'><div align='center'>$i</div></td>n
<td width='250'>$nom</td>n
<td width='50'><div align='center'>$numero</div></td>n
<td width='100'><div align='center'>$motoclub</div></td>n
<td width='70'><div align='center'>$manche1</div></td>n
<td width='70'><div align='center'>$manche2</div></td>n
<td width='70'><div align='center'>$cumul</div></td>n
</tr>n";
}
echo "</table>";
mysql_close ($connection);?>
Chargement en cours