I wrote this simple code which outputs first letters of values (in this case names of companies) stored in every each table row:
include_once('db.php'); //connection with database
$result = mysql_query("SELECT distinct Name FROM companies ORDER BY Name");
while ($row = mysql_fetch_array($result)) {
$letter = substr($row[0], 0, 1);
echo '<p><a href="#">' . $letter . '</a>/p>';
}
The companies table contains names of companies and the $letter variable contains first letter of those names.
Apparently in the companies table there are many names starting with the same letter.
Now, how to display only one letter "A", one letter "B", one letter "C" etc. out of many letters "A", "B", "C" etc.?