Help! Confused...

14 posts by 2 authors in: Forums > CMS Builder
Last Post: May 26, 2013   (RSS)

By Jason - May 26, 2013

Hi,

You can use mysql_count() to total us records.

For example:

Choose a squadron:
                <select name="squadron" size="25" style="width: 220px;">
                
                  <?php foreach (getListOptions("squadron_news", "squadron") as $value => $label): ?>
                    <?php
                      $threeDaysAgo  = date("Y-m-d", strtotime("-3 days"));
                      $totalArticles = mysql_count("squandron_news", "squadron = '".mysql_escape($value)."'");
                      $newArticles   = mysql_count("squandron_news", "squadron = '".mysql_escape($value)."' AND createdDate > '".mysql_escape($threeDaysAgo)."'");
                    ?>
                  
                    <option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['squadron']);?>><?php echo htmlspecialchars($label);?>(<?php echo $newArticles;?>/<?php echo $totalArticles;?>)</option>
                <?php endforeach; ?>
                </select>

Please note that this code hasn't been tested.

Hope this helps get you started.

---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By northernpenguin - May 26, 2013

Thanks Jason!

i will try it tonight.

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

By northernpenguin - May 26, 2013 - edited: May 26, 2013

Jason:  worked great except that you spelled "squadron" incorrectly in "squadron_news"!  Had me stumped for a bit until I noticed the spelling mistake.

Thank you very much, this is working exactly as advertised!

Ragi

--
northernpenguin
Northern Penguin Technologies

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke