[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.*');
$this->db->select('FROM_UNIXTIME(post_date, "%D %M") as pdate');
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
SELECT FROM_UNIXTIME(`post_date`, "%D %M, %Y") as full_date, news.*, "%D %M") as pdate FROM (`site_news` news) WHERE newsID=00006
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