0

i have an array like

Array ( 
[result] => Array ( 
                [0] => stdClass Object ( 
                                    [subs_msg_id] => 31 
                                    [subscriber_id] => 13 
                                    [from_subs_user_id] => 92 
                                    [from_subs_email] => [email protected] 
                                    [message_text] =>mmmmmmmmmmmyyyyyyyyyyyyyy
                                 )
[message_time] => 1428161519 
                ) 
     )
$this->load->view('reply_message_form',$this->data);

i want it access [from_subs_email] element in view page reply_message_form

how do i access that? in codeigniter view

1
  • You want foreach loop. or this std class object array is always a single index array? Commented Apr 4, 2015 at 18:22

1 Answer 1

1

In controller you should append array to data like this:

$data = array();
$data['message'] = Array (....);
$this->load->view('reply_message_form', $data);

Then in view you can access to from_subs_email like this:

<?php echo $message['result'][0]->from_subs_email; ?>

Or you can loop in $message array to print information

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.