Get single row selected column in php

How do you get a single row selected column from the Codeigniter query?

Query:

      $query = $this->db->select('column_name as cn ')->from('table_naem')->where('id', 'your_id')->get()->row()->cn;  Answer : column_name

Explanation:

  1. cn(object) used to get column value.
  2. if we add query before $ we have to see This answer in log
Tagged:
Sign In or Register to comment.