Accueil du forum » Base de données » Petite question de triage php ou mysql... [Réglé]
________________
www.titbod.com - portfolio de Titbod
________________
www.titbod.com - portfolio de Titbod

mysql_query('SELECT DISTINCT (vainqueur) FROM historique WHERE evenement="'.$type.'" ORDER BY `nombre_vic` DESC ');
________________
Anything that can go wrong will go wrong (Murphy)
Statut:
Modérateur

________________
www.titbod.com - portfolio de Titbod
$table = mysql_query("SELECT * FROM historique WHERE evenement='".$type."' ORDER BY
`nombre_vic` DESC");
while($master = mysql_fetch_array($table)){
echo $master['vainqueur']." - ".$master2['nombre_vic']." victoire(s)";
}
________________
Anything that can go wrong will go wrong (Murphy)
Statut:
Modérateur
:
________________
www.titbod.com - portfolio de Titbod
$table = mysql_query('SELECT DISTINCT (vainqueur) FROM historique WHERE evenement="'.$type.'"');
$tableau = array();
$i=0;
function compare($a, $b){
return strcmp($a["victoires"], $b["victoires"]);
}
while($master = mysql_fetch_array($table)){
$table2 = mysql_query('SELECT COUNT(*) AS nombre_vic FROM historique WHERE vainqueur="'.$master['vainqueur'].'"');
$master2 = mysql_fetch_array($table2);
$tableau[$i]["vainqueur"] =$master['vainqueur'];
$tableau[$i]["victoires"] = $master2['nombre_vic'];
$i++;
}
usort($tableau, "compare");
while (list ($key, $value) = each ($tableau)) {
echo $value["vainqueur"]."-".$value["victoires"]." \n";
}
________________
Anything that can go wrong will go wrong (Murphy)
Statut:
Modérateur
$tablemaster = mysql_query('SELECT DISTINCT (vainqueur) FROM historique WHERE vainqueur!="En juin prochain à Gien..." AND vainqueur!="Non existant cette année là" AND vainqueur!="Non communiqué" AND evenement="'.$type.'"');
$tableau = array();
$i=0;
function compare($a, $b)
{
return strcmp($a['victoires'], $b['victoires']);
}
while($master = mysql_fetch_array($tablemaster))
{
$tablemastervic = mysql_query('SELECT COUNT(*) AS nombre_vic FROM historique WHERE vainqueur="'.$master['vainqueur'].'"');
$mastervic = mysql_fetch_array($tablemastervic);
$tableau[$i]['vainqueur'] = $master['vainqueur'];
$tableau[$i]['victoires'] = $mastervic['nombre_vic'];
$i++;
}
usort($tableau, "compare");
while (list ($key, $value) = each ($tableau))
{
echo ''.$value['vainqueur'].' - '.$value['victoires'].' victoire(s)';
}
function compare($a, $b)
{
return strcmp($a['victoires'], $b['victoires']);
}
usort($tableau, "compare");
list ($key, $value) = each ($tableau)"
________________
www.titbod.com - portfolio de Titbod

________________
Le Modérateur de Net-Pratique.
Statut:
Modérateur
________________
www.titbod.com - portfolio de Titbod

________________
Le Modérateur de Net-Pratique.
Statut:
Modérateur
- Les conditions générales d'utilisation du site
| Sujet | Forum |
|---|---|
Sujet posté par melanie le 03/12/2008 à 20h54'42 |
![]() |
Sujet posté par soulkats le 03/12/2008 à 17h43'31 |
![]() |
Réponse postée par raptor le 27/11/2008 à 20h39'51 |
![]() |
Réponse postée par tieno le 26/11/2008 à 14h54'54 |
![]() |
Réponse postée par tieno le 23/11/2008 à 13h55'24 |
![]() |
Sujet posté par touret le 13/11/2008 à 08h58'09 |
![]() |
Réponse postée par xerses le 09/11/2008 à 18h57'14 |
![]() |
Réponse postée par unit le 03/11/2008 à 15h53'53 |
![]() |
Réponse postée par froogy le 26/10/2008 à 16h40'03 |
![]() |
Réponse postée par rer le 23/10/2008 à 16h11'03 |
![]() |