Display two different array return value in single table in codeigniter -
i want show return 2 array value in single table in view,i run first array value in table.
controller
public function communication(){ $session_data = $this->session->userdata('admin_logged_in'); $id = $session_data['id']; if ($this->session->userdata('admin_logged_in')) { $data['get_all_mail'] = $this->admin_model->get_all_mails($id); $data['get_out_mail'] = $this->admin_model->get_out_mails($id); $this->load->view('communication',$data); } }
model
function get_all_mails($id){ $query = $this->db->query("select * t_communication_posting find_in_set($id, replace(`to`, ', ', ',')) or find_in_set($id, replace(`cc`, ', ', ',')) or find_in_set($id, replace(`bcc`, ', ', ',')) <> 0"); return $query->result_array(); }
view
<table id="mytable"> <tbody> <?php foreach ($get_all_mail $get_all_mails) { ?> <tr onclick="return get_mail_content(<? php echo $get_all_mails['m_id']; ?>)" id="target-list"> </td> <td class="email-title" > <?php echo $get_all_mails['from']; ?> </td> <td class="email-body" > <?php echo $get_all_mails['subject'] ?> </td> </tr> <?php } ?> </tbody> </table>
here want run second array value ($data['get_out_mail']) in above table on view page,how run 2 array value in single table.
you can add loop in view file.
<?php foreach ($get_all_mail $get_all_mails) { ?> <tr onclick="return get_mail_content(<?php echo $get_all_mails['m_id']; ?>)" id="target-list"> <td class="email-title" > <?php echo $get_all_mails['from']; ?> </td> <td class="email-body" > <?php echo $get_all_mails['subject'] ?> </td> </tr> <?php } ?> <?php foreach ($get_out_mail $get_out_mails) { ?> <tr onclick="return get_mail_content(<?php echo $get_out_mails['m_id']; ?>)" id="target-list"> <td class="email-title" > <?php echo $get_out_mails['from']; ?> </td> <td class="email-body" > <?php echo $get_out_mails['subject'] ?> </td> </tr> <?php } ?>
this you.
Comments
Post a Comment