Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter select as

how doHow do we do select table.value as table_value from table in codeigniter?
The AS part doesnt work because when i try to access the value, this doesnt work:

    $qry_inp =  'select table.value as table_value from table '
    $query = $this->db->query($qry_inp); 

    echo $query->row('table_value ');// this will be empty, but it shouldn`t be

doesn`t matter if its in AR or simple query

like image 674
Semur Nabiev Avatar asked Dec 04 '22 03:12

Semur Nabiev


1 Answers

Pretty simple thing.

$this->db->select('COLUMN_ACTUAL_NAME as `COLUMN_NAME_YOU_WANT_TO_SHOW`');
like image 115
Bugfixer Avatar answered Dec 28 '22 08:12

Bugfixer