[SQL] Il ne trie pas mon tableau par ordre alpha

Il ne trie pas mon tableau par ordre alpha [SQL] - PHP - Programmation

Marsh Posté le 19-04-2004 à 14:51:04    

Bonjour, j'ai un tableau avec nom d artiste titre etc.. j'aimerai qu il m affiche par ordre alphabetique des nom d artiste mais malheureusement ca  ne fct pas, voici ma requete :
 

Code :
  1. $requete = mysql_query("SELECT * FROM conduite WHERE numero_date = '$chro' ORDER BY nom_groupe DESC" ) or die(mysql_error()) ;


 
nom_groupe etait biensur le nom du groupe.
 
Que faire  :sweat:

Reply

Marsh Posté le 19-04-2004 à 14:51:04   

Reply

Marsh Posté le 19-04-2004 à 15:09:56    

tu peux efectuer plusieurs classement de colonnes, par ex pr classer par groupe alphabétiquement et aussi par artiste, faut faire qqch dans le genre :
SELECT * FROM conduite WHERE numero_date = '$chro' ORDER BY nom_groupe DESC,nom_artiste DESC(ou ASC commme tu veux)

Reply

Marsh Posté le 19-04-2004 à 15:14:30    

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SSELECT * FROM conduite WHERE numero_date = '2' ORDER BY nom_gr
 
:s

Reply

Marsh Posté le 19-04-2004 à 15:14:52    

voici mon tableau  
 

Code :
  1. if( !isset($chro) ) $chro = $_GET['chro'] ;
  2. $requete = mysql_query("SELECT * FROM conduite WHERE numero_date = '$chro' ORDER BY nom_groupe DESC'" ) or die(mysql_error()) ; 
  3.             echo '<table class="TableauPrincipalPlaylist">';
  4. echo '<tr>' ;
  5. echo '<td class="TableauNomGroupe">Nom du groupe</td>' ;
  6. echo '<td class="TableauTitreGroupe">Titre</td>' ;
  7.     echo '<td class="TableauLabel">Label</td>' ;
  8. echo '<td class="TableauCote">Cote</td>' ;
  9. echo '<td class="TableauInfo">Info supp.</td>' ;
  10.  echo '</tr>' ;
  11. while ($line = mysql_fetch_array($requete))
  12. {
  13. // Remplacer les champs vide
  14. if ( $line['nom_groupe'] == '' ) $line['nom_groupe'] = '/' ;
  15. if ( $line['titre'] == '' ) $line['titre'] = '/' ;
  16. if ( $line['label'] == '' ) $line['label'] = '/' ;
  17.     if ( $line['cote'] == '' ) $line['cote'] = '/' ;
  18. if ( $line['info'] == '' ) $line['info'] = '/' ;
  19. // Affichage de la ligne
  20. echo '<tr>' ;
  21. echo '<td class="tableaux">'.nl2br($line['nom_groupe']).'</td>' ;
  22. echo '<td class="tableaux">'.nl2br($line['titre']).'</td>' ;
  23. echo '<td class="tableaux">'.nl2br($line['label']).'</td>' ;
  24. echo '<td class="tableaux">'.nl2br($line['cote']).'</td>' ;
  25. echo '<td class="tableaux">'.nl2br($line['info']).'</td>' ;
  26. echo '</tr>' ;
  27. }
  28. echo '</table>' ;
  29. ?>


Message édité par Dolby le 19-04-2004 à 15:44:42
Reply

Marsh Posté le 19-04-2004 à 15:17:40    

t'as deux S dans ton Select


---------------
The world does not belong to those who get up early but to those who never sleep
Reply

Marsh Posté le 19-04-2004 à 15:20:28    

je verif

Reply

Marsh Posté le 19-04-2004 à 15:40:53    

il n'affiche plus rien :/

Reply

Marsh Posté le 19-04-2004 à 15:44:19    

SSELECT * FROM conduite WHERE numero_date = '$chro' ORDER BY nom_groupe DESC'
vire le S en trop au début et le ' en trop a la fin

Reply

Marsh Posté le 19-04-2004 à 15:50:46    

il m affiche par ordre d envers d alphabetique lol
du w au a
 
que faire ?

Reply

Marsh Posté le 19-04-2004 à 15:51:37    

merci ca marcheeeeeee (asc)

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed