I have a DB table with alot of city names. I get these citys listed like this in alfabethic order.
$result = mysql_query($query);
$cities = array();
while($r = mysql_fetch_row($result)) {
$cities[] = array('id'=>$r[0],'name'=>$r[1],'link'=>$r[2]);
sort($array);
}
$numbercolumns = 3;
$numbercities = mysql_num_rows($result);
$numbercitiescolumns = ceil($numbercities/$numbercolumns);
?>
Then I get the record out like this.
<?php
$currLetter = '';
$c = 0;
for($i=0;$i<$numbercolumns;$i++) {
echo '<td width="33%" valign="top">';
for($x=0;$x<$numbercitiescolumns;$x++) {
if(!isset($cities[$c])) { break; }
if($cities[$c]['name']{0} != $currLetter) {
if($x!=0) { echo '<br>'; }
echo '<img src="img/2006/letters/'.strtolower($cities[$c]['name']{0}).'.png" alt="" /><br>';
$currLetter = $cities[$c]['name']{0};
}
echo '<a href="'.$klubber[$c]['link'].'">'.$klubber[$c]['navn'].'</a>';
}
echo '<br>';
$c++;
}
echo '</td>';
}
?>
My problem is that if I get a danish city starting with the letter "Å" it can't show the image "Å.png"
So my question is: How do I make an array and put it in to my code make it change the letters to numbes like A = 1.png, B= 2.png etc. etc.
Can somebody please help....?