MYSQL Record Count

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

By shawn - July 14, 2014

Hi guys,

I have created a checkbox called "Popular" and at the moment its returning the count of all listings checked. However, how do I get a count of listings checked as popular belonging to my multi-list values? i.e.  'where' => "city = 'CT'",

list($listingRecords, $listingMetaData) = getRecords(array(
    'tableName'   => 'listing',
    'where' => "city = 'CT'",
  ));

This is giving me the record count of all listings checked "Popular".

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

I want to know how many listings are checked popular for the City = "CT"...

Any assistance greatly appreciated.

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 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 :)