Show number of labels

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 3, 2013   (RSS)

By Djulia - April 3, 2013 - edited: April 3, 2013

Hi Rui,

Jason suggests a solution here:
http://www.interactivetools.com/forum/forum-posts.php?postNum=2213208

<select>
<option value="?">My list</option>
  <?php foreach (getListOptions('myTableName','myFieldName') as $value => $label): ?>
  <?php $lisitingCount = mysql_count('myTableName', "myFieldName= '$value'"); ?>
    <option value="<?php echo $value; ?>" <?php selectedIf($value, @$_REQUEST['format']); ?>><?php echo $label; ?> - <?php echo $lisitingCount;?></option>
  <?php endforeach; ?>
</select>

<ul>
  <?php foreach (getListOptions('myTableName','myFieldName') as $value => $label): ?>
  <?php $lisitingCount = mysql_count('myTableName', "myFieldName= '$value'"); ?>
   <li><?php echo $label; ?> - <?php echo $lisitingCount;?></li>
  <?php endforeach ?>
</ul>

I hope this helps!

Djulia

By rui - April 3, 2013 - edited: April 4, 2013

Hi Djulia,

tks for the help, you hit the spot :)

Rui