I want to get it in an array like this
Blog ID => Number of comments for that blog
Ex:
Code: Select all
Array
(
[1] => 7
[2] => 3
)I have this piece of code here
Code: Select all
// empty arrays
$final = array();
$blogids = array();
// loop through results, and store comment ids into an array ($final);
// and store a count of comments particular to each blog
// BlogID => numComments
while($checka = mysql_fetch_assoc($checkr)){
// make sure they own this comment
if($checka['userid'] == $theperson){
// they do, so add it to array
$final[] = $checka['id'];
// if the blog id is already in the array, increment the comment count for that blog id
if(in_array($checka['bid'],$blogids)){
$blogids[$checka['bid']] = $blogids[$checka['bid']] + 1;
}
// its not in the blog id array, so add it to it
else {
$blogids[$checka['bid']] = 1;
}
}
}Code: Select all
Array
(
[3] => 1
[2] => 1
)Code: Select all
Array
(
[3] => 3
[2] => 1
)