![]() |
Active Record: fields from formula-Problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Active Record: fields from formula-Problem (/showthread.php?tid=29249) |
Active Record: fields from formula-Problem - El Forum - 04-04-2010 [eluser]Ornis[/eluser] I want to run the following mysql query: SELECT id, CONCAT(number," ", species) FROM table If I use active record: $fields = "id, CONCAT(number,\" \", species)"; $this->db->select($fields); I run into an error, because Codeignter inserts high-comma within the statement. Is their a workaround for this problem? Thanks Martin Active Record: fields from formula-Problem - El Forum - 04-04-2010 [eluser]davidbehler[/eluser] Code: $this->db->select('id'); CI tries to protect table/column identifiers, that's what causes the high-comma. By passing FALSE as second parameter you can disable this feature. Active Record: fields from formula-Problem - El Forum - 04-04-2010 [eluser]Ornis[/eluser] Thanks. It works well this way. Active Record: fields from formula-Problem - El Forum - 06-29-2011 [eluser]mineass[/eluser] by passing FALSE you disable protect_identifiers for whole query and not only this select line |