php - Codeigniter explode to html table -


i'm having issue explode html table.

my controller

public function idp_test() {     $this->load->model('groups/groups_model');     $scholar_id = $this->session->userdata('scholar_id');     $groups = $this->groups_model->retrieve_groups_idp($this->scholar->level_id);      $content = array(         'groups'            => $groups,         'scholar'           => $this->scholar,         'page_title'        => 'my individual development plan',         'page_view'         => 'scholar/activities/idp_test',         'page_scripts_view' => 'scholar/inc/_choose_activities_scripts',         'sidebar_menu'      => 'idp test'     );       $this->load->view("theme/base", $content); } 

my model

public function retrieve_groups_idp($level_id) {      $this->db->select("groups.*, levels.name levelname");     $this->db->join('activities', 'groups.activity_ids = activities.activity_id' );     $this->db->join('levels', 'levels.level_id = groups.level_id', 'left' );     $this->db->join('activity_types', 'activities.activity_type_id = activity_types.activity_type_id', 'left' );     $this->db->where('groups.level_id', $level_id);     $this->db->group_by('groups_name');     $this->db->order_by('groups_name');      $qr = $this->db->get('groups');      return $qr->result(); }  public function retrieve_activity_desc($activity_ids) {         $activity_desc_arr[] = explode(', ', $activity_ids);          foreach ($activity_desc_arr $activity_id){              $this->db->select("activity_id activityid, concat(activities.name, ' - ', activity_types.name) description", false);             $this->db->join('activity_types', 'activities.activity_type_id = activity_types.activity_type_id');             $this->db->where_in('activities.activity_id', $activity_id);              $qr = $this->db->get('activities');              return $qr->result();         } } 

my view

<?php foreach ($groups $groups): ?>                         <table class="table table-vcenter">                             <thead>                                 <tr class="active">                                     <th><?php echo $groups->groups_name?></th> <!--series header -->                                     <th class="text-center"><small><strong>module type</strong></small></th>                                     <th class="text-center"><small><strong>status</strong></small></th>                                     <th class="text-center"><small><strong>action</strong></small></th>                                 </tr>                             </thead>                             <tbody>                                     <tr>                                         <td><?php                                                  $rows = $this->groups_model->retrieve_activity_desc($groups->activity_ids);                                                     foreach ($rows $row){                                                         echo var_dump($row->description);                                                     }                                         ?></td>                                         <td class="text-center">belom lagi</td>                                         <td class="text-center">to attend</td>                                         <td class="text-center"><a href="javascript:void(0)" class="label label-success">view session</a></td>                                     </tr>                             </tbody>                         </table>                         <?php endforeach ?> 

i can't post images, below sample in view far


series 1 fs | module types | status | action


series 1 - filseries 1 - cblseries 1 - pel | belom lagi | attend |


and need achieve below sample in view


series 1 fs | module types | status | action


series 1 - fil | belom lagi | attend |


series 1 - cbl | belom lagi | attend |


series 1 - pel | belom lagi | attend |


i'm newbie php & codeigniter, sorry english.

thanks

think have in view code:

<tr>   <td><?php      foreach($rows $row){       var_dump($row->description);     }   ?>   </td>   <td>belom lagi</td>   <td>to attend</td>     </tr> 

of course printed 1 table cell, how produce else, right?

what need this:

<?php   foreach($rows $row){     echo "<tr>"; // need new row every entry     echo "<td>".$row->description."</td>";     echo "<td>belom lagi</td>";     echo "<td>to attend</td>";     echo "</tr>";   } ?> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -