Jump to content

sub array value


krike

Recommended Posts

In codeIgniter I have the following returned array:

 

Array
(
    [0] => stdClass Object
        (
            [id] => 1
            [name] => 01. Underworld
            [userid] => 1
            [order] => 1
        )

    [1] => stdClass Object
        (
            [id] => 2
            [name] => 02. Pain in the ass
            [userid] => 1
            [order] => 2
        )

)

 

I need the to save the id into a variable and send it as parameter for the new functions, but I don't know how to do this. Any help would be appreciated, this is the controller function:

 

/*###################################################*/
function members_area()
/*###################################################*/
{
	global $site_title;
	$this->load->model('membership_model');

	if($this->membership_model->get_villages()):
		$villages = $this->membership_model->get_villages();
		$data['rows'] = $villages;
		echo "<pre style='text-align:left;'>";
		print_r($villages);
		echo "</pre>";
		$id = 1;//this should be dynamic, but how?
		if($this->membership_model->get_tasks($id)):
			$data['tasks'] = $this->membership_model->get_tasks($id);
		endif;
	endif;

	$data['title'] = $site_title." | Your account";
	$data['main_content'] = 'account';
	$this->load->view('template', $data);
}//end of function members_area

Link to comment
https://forums.phpfreaks.com/topic/197995-sub-array-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.