Problem with Select in Codeigniter - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Problem with Select in Codeigniter (/showthread.php?tid=56136) |
Problem with Select in Codeigniter - El Forum - 11-28-2012 [eluser]yoelrodguez[/eluser] Hi all I’m having problems when I try to insert a function of Select detro example DATE_FORMAT (date_end, ‘% W% M% Y’) AS dateend here tells me that the ‘% W% M% Y’ the method is unknown I’m using is: $ this-> db-> select (name, DATE_FORMAT (date_end, ‘% W% M% Y’) AS dateend) Problem with Select in Codeigniter - El Forum - 11-28-2012 [eluser]Eduard Stankovic[/eluser] It because CodeIgniter tries to escape these values, if you add additional parameter (false), escaping will be ignored Code: $this->db->select("DATE_FORMAT (date_end, ‘% W% M% Y’) AS dateend", false); I hope its help and sorry for my English Problem with Select in Codeigniter - El Forum - 11-28-2012 [eluser]CroNiX[/eluser] I also answered this in his other (this is a duplicate) post. In addition to the identifiers issue, the parameters passed to date_format ('% W% M% Y') is totally wrong. 1) it starts with a %, with no specifier 2) MySQL uses the % before the specifier, but the poster is doing it backwards (W% instead of %W) 3) there is a 'Y' by itself http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format |