Hey Guys,
Ok here is my problem:
There is around 350 rows in the db.
All the variables $actor_id, $comment_id and $likes_id are all uid's for facebook users
Now i want to group and sum how many entries there are of each unique uid
Say for example the number:
'65653171' came up
10 times as a $actor_id
5 times as a $comment_id
3 times as a $likes_id
and
'67418530' came up
5 times as a $actor_id
21 times as a $comment_id
3 times as a $likes_id
Then i want a query that would display in order of most entries:
1.) 67418530 (29)
2.) 65653171 (18)
Thanks for the help, real brain teazer for me.
This is the code i use to fetch the Data from the FQL Table, a preview of the FQL Table can been seen on the bottom of this thread. - $query = "SELECT post_id, actor_id, comments, likes FROM stream WHERE source_id = ".$user." LIMIT 500";
-
$result = mysql_query($query);
-
$count = count($result);
-
$total=$count;
-
-
-
for ($i = 0; $i < $count; $i++)
-
{
-
-
$actor_id = $result[$i][actor_id];
-
$count_c = $result[$i][comments][count];
-
-
if($count_c > 0){
-
for ($a = 0; $a < $count_c; $a++){
-
$comment_id = $result[$i][comments][comment_list][$a][fromid];
-
-
}
-
}
-
-
-
$count_l = $result[$i][likes][count];
-
-
if($count_l > 0){
-
for ($b = 0; $b < $count_l; $b++){
-
$likes_id = $result[$i][likes][friends][$b];
-
-
}
-
}
-
-
-
-
-
}
This is how the information is stored in the DB