Jump to content
Old threads will finally start getting archived ×

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.