![]() |
Can't use multiple FROM_UNIXTIME? - 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: Can't use multiple FROM_UNIXTIME? (/showthread.php?tid=12923) |
Can't use multiple FROM_UNIXTIME? - El Forum - 11-05-2008 [eluser]aquary[/eluser] I have a problem trying to use multiple FROM_UNIXTIME in CodeIgniter. I want 2 types of date format so I can use the same function on different part. The problem part is: Code: $this->db->select('FROM_UNIXTIME(post_date, "%D %M, %Y") as full_date, news.*'); At first, the select part was only 1 line, but I got database error when trying to execute it. The error : Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as pdate FROM (`site_news` news) WHERE newsID=00006' at line 1 The code runs fine if I put only one FROM_UNIXTIME. I don't understand why the last FROM_UNIXTIME( dissappear from the query.... Any ideas? Thanks ![]() Can't use multiple FROM_UNIXTIME? - El Forum - 11-05-2008 [eluser]GSV Sleeper Service[/eluser] try adding FALSE as a second parameter to $this->db->select(). from the manual Quote:$this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement. |