Generally, when a function/method call returns something, and you need that something later on, you need to "receive/assign" it to something else. Your $post->get_news($user_id); returns an array, but there is NOTHING "receiving" that array. Also, just because your method get_news() returns an array, it does NOT "overwrite" the $post variable. Thus, after the method call, the $post variable is still a 'News' object. So $post[$i] is not valid - again, because $post is NOT an array - it is still a News object. So try:
$post=new News;
$data = $post->get_news($user_id);
//to verify that you got the array you were expecting
print_r($data);
for($i=0; $i<5; $i++){
foreach($data[$i] as $k=>$v){
echo $v; //get error: "Cannot use object of type News as array in ..."
}
} On another note, the only similarity between your thread and the other was that both of you have the need to retrieve data from the db. You are way ahead of the game since you already have some php code in place that needs minor fixing. The other poster didn't seem to have anything in place yet.
Regards,
Hielo