Welcome Guest, Not a member yet? Register   Sign In
filter using mysql query.. simple social network website
#1

[eluser]rei[/eluser]
Hi. Im currently building a simple social network. But I'm a little bit stuck. Here's the problem:

I made a latest wall posts widget that shows the latest posts of the poeple he/she is following. It is working fine. But the problem is it is also showing the followed users wall posts in other users profile. I want to filter the posts, only the post that is posted in the profile of the poster will be shown. Sorry for my bad english I hope someone will understand what I'm talking about.

Here is my current code to query the posts:
Code:
function get_stalked_users_latest_posts($usernames, $limit, $order = 'desc')
{
$this->db->select('post, author');
$this->db->where_in('author', $usernames);
$this->db->limit($limit);
$this->db->order_by("date_time", $order);
$query = $this->db->get('posts');

return $query;
}

explanation for the mysql query -- I currently have a where_in statement for fetching the posts because $usernames is an array. $usernames array is the usernames of the persons that the current logged in user has followed/stalked. It works, the only problem is how can I filter it so it will only show the posts of the user if the post has been posted in his/her own profile. hmmm.

Thanks in advance for your responses Smile


Messages In This Thread
filter using mysql query.. simple social network website - by El Forum - 08-03-2012, 11:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB