Simple question

2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 15, 2010   (RSS)

Re: [willbegood] Simple question

By Chris - January 15, 2010

Hi willbegood,

You can do that with SQL, or use a little helper function called mysql_select_count_from():

<?php
$tableName = "news";
$whereClause = "category = 'SPORTS'";
$count = mysql_select_count_from($tableName, $whereClause);
echo $count;
?>


The code above makes some assumptions (in red) about your table and field names. You may need to change these depending on how you've configured your sections.

I hope this helps. Please let me know if you have any questions. :)
All the best,
Chris