[eluser]markanderson993[/eluser]
Hey, I've got a simple question for you, so here goes!
I have a function that builds an array and returns it. The only problem is I keep getting the same error. Here's what I've got. Does anybody know how to make the bad man stop? :/
Code:
function get_friends($user_id)
{
$array = array();
$this->db->where('user_id',$user_id);
$get_friends_rows = $this->db->get('friends');
if ($get_friends_rows->num_rows() > 0)
{
foreach($get_friends_rows->result() as $row)
{
$array[] = $row->friend_id;
}
}
$this->db->where('friend_id',$user_id);
$get_friends_rows = $this->db->get('friends');
if ($get_friends_rows->num_rows() > 0)
{
foreach($get_friends_rows->result() as $row)
{
$array[] = $row->user_id;
}
}
return $array;
}
And here is how I apply it in my view
Code:
<?=$friends_array = $this->friends_model->get_friends($this->uri->segment(3))?>
<? foreach($friends_array->result() as $row): ?>
<?=$row?>
<? endforeach; ?>
And this is the error I get
Quote:Array
Fatal error: Call to a member function result() on a non-object in .../application/views/includes/user/profile_image_include.php on line 72
Any help would be greatly appreciated!!!
- Pianoman993