In mysql I can query as following:
select studentname,'student' as profession from students
It returns something like:
studentname | profession
------------+-----------
name1 | student
name2 | student
...
But how can I do so in codeigniter using active records? I am a newbie to CI, so your help is appreciated.
Note: Just to clear my question, there is no column named student or profession in the students table. student is a fixed text that I want to have with my resultset.
If I query something like:
$this->db->select("studentname, student as profession")->from('students')
then it gives error as it try to find student column while it’s just a static value.
select has a second option. Set it to false and try –