What i am trying to accomplish is to have a little list of user blogs on the members page. The little snippet is only to retirive a limit of 5 blogs from all members that he has as firends. Almost like myspace. But the problem is that i get only the first blog from all users and doenst retirve 5 of them, And not the most recent of the blogs. Can some look over my code and let me know what I am doing wrong.
$member_blogs = "";
$_query = "select * from ".$prefix."friends WHERE user = '$login' and accepted = 'Yes'";
$_result = @MySQL_query($_query);
if (mysql_num_rows($_result)== 0){
$member_blogs .= "<tr><td width=100%>No Member Blogs</tr></td>";
}
$member_blogs = "";
WHILE($_rows = @mysql_fetch_array($_result)){
$friend[] = $_rows['friend'];
foreach($friend as $key => $value){
$query = "select * from ".$prefix."Message WHERE id = '$value' ORDER by no ASC LIMIT 5";
$result = @MySQL_query($query);
$rows = @mysql_fetch_array($result);
$id = $rows[id];
$subject = truncate($rows[subject],25);
}
$member_blogs .= "<tr><td width=30%><a href=\"$root_url/$id\">$id</a><td><td width=70%><a href=\"index.php?page=blog&e=$rows[no]\">$subject</a></tr></td>";;
}