[Active Record] Selecting data 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] Selecting data problem (/showthread.php?tid=14855) |
[Active Record] Selecting data problem - El Forum - 01-18-2009 [eluser]Clooner[/eluser] My goal is te generate this query using ActiveRecord Code: SELECT id I am attempting this by using this code Code: $this->db->select("id"); But Activerecords messes it up and generates this Code: SELECT `id` Which is an entirely different query since it adds the punctuation to the select query. This makes mysql see this a a string and not an query. I have searched the user guide on how to disable punctuation generation(it rhymes) but didn't find anything there. How would I have to use ActiveRecord generate the top query? [Active Record] Selecting data problem - El Forum - 01-18-2009 [eluser]Armchair Samurai[/eluser] This should work but hasn't been tested: Code: $sql = '(SELECT child FROM category_relations)'; [Active Record] Selecting data problem - El Forum - 01-18-2009 [eluser]Clooner[/eluser] [quote author="Armchair Samurai" date="1232289371"]This should work but hasn't been tested:[/quote] This code works, thanks a lot. But I wonder isn't there a complete ActiveRecord way of doing this? [Active Record] Selecting data problem - El Forum - 01-24-2009 [eluser]Clooner[/eluser] Again I ran into the same problem with Active records Code: $this->db->select("highlights.*"); Code: SELECT highlights. * , Code: SELECT `highlights`.`*`, How should I do this query using Active records or maybe even better: Turn off the auto escaping of some parts of my query [Active Record] Selecting data problem - El Forum - 01-24-2009 [eluser]Clooner[/eluser] I found in the user guide that if I change Code: $this->db->select("highlights.*"); into Code: $this->db->select("highlights.*",false); Active records will not produce the backticks in the select statement. |