I want to show in alphabetical order the contents of a column of a table in SQL. For example I have tried this but only two return me, whereas I have a lot more, the nomeid contains the COUNT of the database.
$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++;
}