In try the following PHP. It should create a list of two characters in the $Result Array. It works by getting a list of names from the database and everytime $Counter returns to zero (because of the % 18) it pushes the current name's initial two characters into the results. The last if statement captures the last result if it has just been added to the results.
There are better places to be asking PHP questions, like the Community Forums at
http://www.webxpertz.net/forums/
The PHP:
$Query = 'select name from table order by name';
$ResultSet=mysql_query($Query);
$Counter = 0;
$Result = array();
while($Row=mysql_fetch_assoc($ResultSet))
{
if( $Counter == 0 )
array_push($Result,substr($Row['name'],0,2));
$Counter = ($Counter + 1) % 18;
}
mysql_free_result($ResultSet);
if($Counter != 1)
array_push($Result,substr($Row['name'],0,2));