Récupérer variable en sortie de boucle ?
Posté : 21 mars 2007, 14:06
Bonjour et d'avance merci pour vos réponses !
Alors voilà mon problème je fais une boucle où je récupère plusieurs infos dans ma base pour chaque joueur :
$ligne_show_players["flags"] ;
$ligne_show_players["kills"] ;
$ligne_show_players["deaths"] ;
Et j'ai besoin de ces variables après ma boucle pour afficher un graphique, est-ce qu'il y a un moyen simple de tout récupérer ?
Le code n'est certainement pas trés propre mais je débute
Alors voilà mon problème je fais une boucle où je récupère plusieurs infos dans ma base pour chaque joueur :
$ligne_show_players["flags"] ;
$ligne_show_players["kills"] ;
$ligne_show_players["deaths"] ;
Et j'ai besoin de ces variables après ma boucle pour afficher un graphique, est-ce qu'il y a un moyen simple de tout récupérer ?
Le code n'est certainement pas trés propre mais je débute
<?php
if (isset($_GET['tri'])) { $tri = $_GET['tri'] ; }
else { $tri = "id_player" ; }
$i = 0 ;
$connect2 = "SELECT *
FROM ".$INFO['sql_tbl_prefix']."wars_players
WHERE id_match=".$section."
ORDER BY ".$tri." DESC " ;
$ligne2 = mysql_query($connect2) ;
while ($ligne_show_players = mysql_fetch_array($ligne2))
{
$i++ ;
$ratio = $ligne_show_players["kills"] / $ligne_show_players["deaths"] ;
?>
<tr id="ligne01">
<td id="player"><? $connect3 = "SELECT name
FROM ".$INFO['sql_tbl_prefix']."members
WHERE id=".$ligne_show_players["id_player"]." " ;
$my_query3 = mysql_query($connect3) ;
$query_pseudo = mysql_fetch_array($my_query3) ;
// $player_$i_name = $query_pseudo['name'] ;
$toto = $ligne_show_players["deaths"] ;
echo $query_pseudo['name'] ; ?>
</td>
<td id="flags"><? echo $ligne_show_players["flags"] ; ?></td>
<td id="kills"><? echo $ligne_show_players["kills"] ; ?></td>
<td id="deaths"><? echo $ligne_show_players["deaths"] ; ?></td>
<td id="ratio"><? echo substr($ratio, 0, 4) ; ?></td>
<td id="deaths"><? echo $i ; ?></td>
</tr>
<?
}
?>