![]() |
Active record select 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 select problem (/showthread.php?tid=55532) |
Active record select problem - El Forum - 10-31-2012 [eluser]mejlo[/eluser] Hi, Code: ->select('DATE_FORMAT(FROM_UNIXTIME(created_at), "%e.%b.%Y") as created', FALSE) Code: [created] => 30.nic_Oct.2012 Active record select problem - El Forum - 11-02-2012 [eluser]clive_turner[/eluser] Had similar problems with CONCAT and Date_Format. The issue is the commas in SELECT clauses. Active Record explodes the SELECT clause using "," as a delimiter, to turn the string into an array of fields. While this works with simple select statements like col1, col2, col 3, it produces strange results with any SELECT statement that contains a comma eg CONCAT and DATE_FORMAT. The solution is to enter the SELECT fields as an array and not as a string, so it bypasses the explode function. ie Code: $select=array("CONCAT( HouseNo, ', ' , Address1 ) AS Property", Active record select problem - El Forum - 11-02-2012 [eluser]mejlo[/eluser] Works ![]() Thx. |