Array assoc php?

shreek69 Messages postés 236 Date d'inscription   Statut Membre Dernière intervention   -  
 Profil bloqué -
Bonjour voici ma requete qui n'affiche que le premier cham de ma base de donne
jai essaie avec une boucle rien de bon
pourriez vous maider
merci

for ($i=0; $i<20;$i++){
$query = ("select PLAYERS_NAME from players WHERE TEAM_NAME='Lyon' ");
$resultat=mysql_query($query);
$array = mysql_fetch_assoc($resultat);
print_r($array);
var_dump($array) ;
//echo 'This is : ' . $array['PLAYERS_NAME'];
}
A voir également:
  • Array assoc php?
  • Expert php - Télécharger - Langages
  • Easy php - Télécharger - Divers Web &amp; Internet
  • Ide php - Télécharger - Web &amp; Internet
  • Php alert - <a href="https://forums.commentcamarche.net/forum/php-155">Forum PHP</a>
  • \N php - <a href="https://forums.commentcamarche.net/forum/php-155">Forum PHP</a>

2 réponses

avion-f16 Messages postés 19182 Date d'inscription   Statut Contributeur Dernière intervention   4 511
 
0
Profil bloqué
 
Je ne comprends pas pourquoi tu boucles 20 fois sur la même requête ?

Essaie :
$query = ("select PLAYERS_NAME from players WHERE TEAM_NAME='Lyon' "); 
$resultat=mysql_query($query); 
$array = array();
while($row = mysql_fetch_assoc($resultat)) $array[] = $row;
print_r($array);
0