Welcome Guest, Not a member yet? Register   Sign In
Getting data in a big array codeigniter
#6

I would do it like this:
Controller:
PHP Code:
$data['suggested'] = $this->User_model->getFriendSuggestions(); 

View:
PHP Code:
Foreach($suggested['suggestedUser'] as $s_user)
{
    Print_r($s_user);   //check the output of $s_user, is it an array?


Maybe you're making thinks over complicated by using the same name for the array and for elements in the array. One way to deal with this is using the plural form for the array itself, e.g. suggestedUsers. Then it's clear that there can be more than one.
Reply


Messages In This Thread
Getting data in a big array codeigniter - by tp45 - 09-27-2019, 01:05 PM
RE: Getting data in a big array codeigniter - by Wouter60 - 10-01-2019, 11:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB