MYSQL Record Count

5 posts by 2 authors in: Forums > CMS Builder
Last Post: July 15, 2014   (RSS)

By claire - July 15, 2014

Hi Shawn

What does your 'popular' field look like?

--------------------

Claire Ryan
interactivetools.com

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

By shawn - July 15, 2014

Hello Claire

Thank you for the reply. Not sure what you mean exactly? It's just a checkbox field type with fieldname "popular". The table name is 'tableName'   => 'listing',

Popular (value): <?php echo $record['popular'] ?>
Popular (text):  <?php echo $record['popular:text'] ?>


I have a muli-list called "city".

 City (value): <?php echo $record['city'] ?>
 City (label): <?php echo $record['city:label'] ?>

So I basically I'm filtering my listings: 'where' => "city = 'CT'", and would like to know which over those listings in "CT"are checked as "Popular".

At the moment I can return a count for all listings checked as popular like this, but only want those 'where' => "city = 'CT'"

<? echo mysql_select_count_from('listing','popular');?>

By claire - July 15, 2014

Hi Shawn

Just wanted to be sure I understand what your setup is like. Try this function instead:

<?php echo mysql_count('listing', 'city = "CT" AND popular = 1'); ?>

This will give you a little more leeway in how you select the records.

--------------------

Claire Ryan
interactivetools.com

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

By shawn - July 15, 2014

Works like a charm! Thank you Claire :)