Juned Ansari
Juned Ansari

Reputation: 5275

how to access the array object in codeigniter

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

Upvotes: 0

Views: 3937

Answers (1)

Belal mazlom
Belal mazlom

Reputation: 1850

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

Upvotes: 1

Related Questions