• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
nesting mysql results, need help passing the array to my view

#4
[eluser]skattabrain[/eluser]
thanks for your insights ... thank you very much.

this is what i did shortly after my post ...

Code:
$comments = $this->Profile_data->getCoComments($clientID);
$data['comments'] = $comments;
            
if ($comments->num_rows() > 0)
{
  foreach ($comments->result() as $comment)
   {
     $replies = $this->Profile_data->getReplies($comment->commentID);
     $data["replies"][$comment->commentID] = $replies;
   }
}

then in my view inside the comment loop, i do this ...

Code:
if($replies[$comment->commentID]->num_rows() > 0):
foreach($replies[$comment->commentID]->result() as $reply):
etc ...


Messages In This Thread
nesting mysql results, need help passing the array to my view - by El Forum - 05-16-2008, 02:01 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.