Classement Online S7 #2

 0) { foreach ($array as $k => $v) { if (is_array($v)) { foreach ($v as $k2 => $v2) { if ($k2 == $on) { $sortable_array[$k] = $v2; } } } else { $sortable_array[$k] = $v; } } switch ($order) { case SORT_ASC: asort($sortable_array); break; case SORT_DESC: arsort($sortable_array); break; } foreach ($sortable_array as $k => $v) { $new_array[$k] = $array[$k]; } } return $new_array; } if(IsSet($_GET['liste'])) $action = $_GET['liste']; else $action = ''; if($action =="") { $req = "SELECT * FROM `onlineS72` ORDER BY `onlineS72`.`pseudo` ASC, `onlineS72`.`tournois` DESC"; $envois_req = mysql_query($req); $i = 0; while($row = mysql_fetch_array($envois_req)){ $table[$row['id']] = array($row['pseudo'],$row['tournois'],$row['place'],$row['point']); $i++; } //la table $table contiens tout $req = "SELECT DISTINCT `pseudo` FROM `onlineS72` ORDER BY `pseudo` ASC"; $envois_req = mysql_query($req); // pour chaque pseudo, on verifie les tournois 1 par 1 avec une nouvelle requette while($row = mysql_fetch_array($envois_req)){ //~ $req2 = "SELECT * FROM `jeudi` WHERE `pseudo` = \"".$row['pseudo']."\" ORDER BY `tournois`"; $req2 = "SELECT * FROM `onlineS72` WHERE `pseudo` = \"".$row['pseudo']."\" ORDER BY `point` DESC"; //envois la requette 2 $envois_req2 = mysql_query($req2); //recup des resultat $j = 0; while($row2 = mysql_fetch_array($envois_req2)){ //on compte les points if($j<10) $table_points[$row['pseudo']] = $table_points[$row['pseudo']] + $row2['point']; $table_totale[$row['pseudo']][$row2['tournois']] = $row2['point']; $j++; } } //liste non classé //~ print_r($table_points); //liste classé $classement_final = array_sort($table_points, 'point',SORT_DESC); //~ print_r($classement_final); //~ print_r($table_totale); //creation du tableau total $i = 1; echo " "; echo "
"; echo " "; echo " "; foreach($classement_final AS $key => $value){ $array2[$key] = $value; //echo $i."\t".$key."\t\t\t".$value."\t1:".$res1."\t2:".$res2."\t3:".$res3."\t4:".$res4."\r\n"; if(empty($table_totale[$key][12])) $res12 = "0.00"; else $res12 = number_format($table_totale[$key][12], 2, ',', ''); if(empty($table_totale[$key][11])) $res11 = "0.00"; else $res11 = number_format($table_totale[$key][11], 2, ',', ''); if(empty($table_totale[$key][10])) $res10 = "0.00"; else $res10 = number_format($table_totale[$key][10], 2, ',', ''); if(empty($table_totale[$key][9])) $res9 = "0.00"; else $res9 = number_format($table_totale[$key][9], 2, ',', ''); if(empty($table_totale[$key][8])) $res8 = "0.00"; else $res8 = number_format($table_totale[$key][8], 2, ',', ''); if(empty($table_totale[$key][7])) $res7 = "0.00"; else $res7 = number_format($table_totale[$key][7], 2, ',', ''); if(empty($table_totale[$key][6])) $res6 = "0.00"; else $res6 = number_format($table_totale[$key][6], 2, ',', ''); if(empty($table_totale[$key][5])) $res5 = "0.00"; else $res5 = number_format($table_totale[$key][5], 2, ',', ''); if(empty($table_totale[$key][4])) $res4 = "0.00"; else $res4 = number_format($table_totale[$key][4], 2, ',', ''); if(empty($table_totale[$key][3])) $res3 = "0.00"; else $res3 = number_format($table_totale[$key][3], 2, ',', ''); if(empty($table_totale[$key][2])) $res2 = "0.00"; else $res2 = number_format($table_totale[$key][2], 2, ',', ''); if(empty($table_totale[$key][1])) $res1 = "0.00"; else $res1 = number_format($table_totale[$key][1], 2, ',', ''); echo " "; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $i++; } echo ""; echo "
Pseudo Total #12 #11 #10 #9 #8 #7 #6 #5 #4 #3 #2 #1
$i$key".number_format($value, 2, ',', ' ')."".$res12."".$res11."".$res10."".$res9."".$res8."".$res7."".$res6."".$res5."".$res4."".$res3."".$res2."".$res1."
"; } else { echo "Classement de la manche ".$action."
"; $req = "SELECT * FROM `onlineS72` WHERE `tournois` = ".$action." ORDER BY `place` ASC"; echo " "; echo ""; echo " "; echo " "; //il faut l'id d'un tournois pour pourvoir faire le classement $res = mysql_query($req); while($row = mysql_fetch_array($res)){ echo " "; echo ""; echo ""; echo ""; echo ""; } echo ""; echo "
Place Pseudo Point
".$row['place']."".$row['pseudo']."".number_format($row['point'], 2, ',', ' ')."
"; } /* liste du nombre de tournois par membre SELECT COUNT( tournois ) , pseudo FROM `jeudi` GROUP BY pseudo ORDER BY COUNT( tournois ) DESC */ ?>


Share on Twitter! Digg this story! Del.icio.us Share on Facebook! Technorati Reddit StumbleUpon