Quero mostrar por ordem afabetica o conteúdo de uma coluna de uma tabela cm SQL. Por exemplo experimentei isto mas so me retorne dois registo, enquanto que tenho bem mais, o nombreid contem o COUNT da base de dados.
$y='a';
//for table users
for($i=1;$i<=$nombreid;$i++)
{
$requete = "SELECT * FROM contact WHERE (id=$i) AND nom LIKE '$y%'";
$resultat = $base_hndl->query($requete); //
$affiche = $resultat->fetchArray();// tableau 'affiche'
if($affiche['id']!=0)
{
//write data
echo "<tr class=event bgcolor=$couleur align=left style='font-size:12px;font-family:helvetica'>\n";
echo "<td title=\"$lib_id\"><a href=_compil_vcf.php?id=$affiche[id]>$affiche[id]</a></td>\n";
echo "<td title=\"$lib_nom\">$affiche[nom]</td>\n";
echo "<td title=\"$lib_prenom\">$affiche[prenom]</td>\n";
echo "<td title=\"$lib_fonction\">$affiche[fonction]</td>\n";
echo "<td title=\"$lib_societe\">$affiche[societe]</td>\n";
echo "<td title=\"$lib_mobile\">$affiche[mobile]</td>\n";
echo "<td title=\"$lib_mail\"><a href=mailto:$affiche[mail] title=\"$clic_for_mail\" >$affiche[mail]</a></td>\n";
echo "</tr>\n";
$couleur = get_couleur_fond($couleur,$couleur1,$couleur2);// change de couleur de fond
$y++;
}
ORDER BY
?