Probably pretty simple, but I am having a few issues.
All I am trying to do is “count” how many posts a “certain” “author” has from a certain “category”
Table set up:
id | author | category | full | short
1 jim 2,3 ... ...
2 josh 5,9 ... ...
3 jim 3,9 ... ...
4 jim 1,9 ... ...
5 josh 3,4 ... ...
6 trina 2 ... ...
I know how to query..
But, how do I code a “foreach”
to count how many posts if I query (example query)
WHERE category = '9' AND author = "$author"
So it would show me the posts by that author, which is no big deal, but how would I show :
if $author = “jim”
Jim (2 posts in Category 9)
or if $author = “josh”
Josh (1 post in Category 9)
Thanks in advance!!
Here is what I used, thanks !!
<?php echo $row_Recordset1['author']; echo '(' . $totalRows_Recordset1 . ')'; ?>
you can do it by sql query only no foreach to calculate. not tested by you can do like this
(not tested)
then you can directly count it by