Semur Nabiev Semur Nabiev -4 years ago 203
PHP Question

codeigniter select as

how doHow do we do

select table.value as table_value from table
in codeigniter?

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

Answer Source

Where is that behaviour documented? row doesn't take a column name as a parameter; it optionally takes a row number, and that's it. Access it like any other field:

echo $query->row()->table_value;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download