消息:未定义的索引:获取列名时(两个具有相同列的表)Codeigniter

I want to get the data from two tables with the same column name. I already put some aliases in the column name. But it doesn't work.

Controller

public function price_master_list(){

    $result['mediacat'] = $this->em->getmedia_with_category();
    $this->load->view('price_master_list',$result);
}

Model

function getmedia_with_category(){
    $query2 = $this->db->select('*','m.name as `catname`', false)->from('media as m')->join('media_category as c', 'c.media_id = m.id')->where('m.delete_flag','1')->get();
    $response = $query2->result_array();
    return $response;
}

View

<?php foreach($mediacat as $medcat){ ?>
<tr>
    <td><?php echo $medcat['catname']; ?></td>
</tr>
<?php } ?>

I hope you could help me guys. And Thank you in advance.

Try this,

CI select accepts only two params, you passed three

function getmedia_with_category(){
    $query2 = $this->db->select('m.*,c.name as catname', false)->from('media as m')->join('media_category as c', 'c.media_id = m.id')->where('m.delete_flag','1')->get();
    $response = $query2->result_array();
    return $response;
}