How to display records of select query with left join in table using foreach? How to display records of select query with left join in table using foreach? codeigniter codeigniter

How to display records of select query with left join in table using foreach?


In Model

public function get_user(){    $query = $this->db->query("select a.id, a.name, b.job from table_a a        left join table_b b on b.id=a.id        order by a.id");    $result = $query->result_array();    return $result;}

In Controller

$data['get_user'] = $this->model_name->get_user();$this->load->view("view_name", $data);

In View

<table id="tablestyle" class="table table-bordered table-hover table-condensed">    <col width="50">    <col width="150">    <col width="150">    <col width="150">    <thead>        <tr>            <th><strong>ID</strong></th>            <th><strong>NAME</strong></th>            <th><strong>JOB</strong></th>            <th></th>        </tr>    </thead>    <tbody>        <?php foreach($get_user as $rowItem) {  ?>                <tr>                    <td><?php echo $rowItem['a.id'] ?></td>                    <td><?php echo $rowItem['a.name'] ?></td>                    <td><?php echo $rowItem['b.job'] ?></td>                    <td><input type="submit" value="Modify" id="btnModify" class="btn btn-block btn-success btn-xs" onclick="btnModify('<?php echo $rowItem['a.id'] ?>');"/></td>                </tr>        <?php } ?>    </tbody></table>