El codigo entero :
Código PHP:
<?php
$dbhost = 'localhost';
$dbuser = '***';
$dbpass = '***';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = '***';
mysql_select_db($dbname);
// conexiones y datos necesarios anteriores...
$letters = array();
foreach(range('a','z') as $v){
* * $sql = "SELECT COUNT(*) counter FROM cc_municipals WHERE pueblo LIKE '{$v}%'";
* * $qry = mysql_query($sql) or die(mysql_error());
* * $res = mysql_fetch_assoc($qry);
* * $letters[$v] = ($res['counter'] > 0 ? 'active' : null);
}
?>
*
<ul>
<?php foreach($letters as $k => $v): ?>
* * <li>
* * * * <?php if(!empty($v)): ?>
* * * * * * <a href="#" class="<?php echo $v; ?>"><?php echo $k; ?></a>
* * * * <?php else: ?>
* * * * * * <?php echo $k; ?>
* * * * <?php endif; ?>
* * </li>
<?php endforeach; ?>
</ul>
El error es algo del foreach()