CodeIgniter Forums
Select with string type alias - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Select with string type alias (/showthread.php?tid=74962)



Select with string type alias - luden - 12-01-2019

Hi,

I try to query with alias a string but it does not work: 

$query=$this->db->query('SELECT id_observation as "1" FROM Observation ');

return $query->result();


but this work well with letters :

$query=$this->db->query('SELECT id_observation as "testcolumname" FROM Observation ');

return $query->result();

I did a print_r($this->db->last_query()); and the result works well directly on phpmyadmin but not within the codeigniter framework
I tried to change some settings to the database configuration but it is still the same problem