Counting articles

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 19, 2009   (RSS)

By flamerz - February 19, 2009

I searched info about this one in forum with no luck.

I have an articles archive like this:

Archive
2009 ......... 55 articles
2008 ......... 315 articles
2007 ......... 155 articles

There is a way to get this kind of article count by year?

thanks in advance.

Re: [flamerz] Counting articles

By flamerz - February 19, 2009 - edited: February 19, 2009

i reply myself.

If somebody has more efficient query (p.e. grouping), feel free to fix me. (im new here)

<?php
list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => "YEAR(`date`) = 2009",
'allowSearch' => '0',
));
?>

<?php echo count($newsRecords) ?>