ActiveRecord: dbprefix on tables inside MySQL functions |
[eluser]Unknown[/eluser]
I have dbprefix set to TEST_ and a select statement like the following: DATE_FORMAT(table.date, '%e-%c-%Y') as dk_date table names inside both DATE_FORMAT and TIME_FORMAT doesn't get prefixed with dbprefix.
[eluser]Phil Sturgeon[/eluser]
Sadly, although the ActiveRecord class is brilliant, it is not magic. You need to tell it the prefix if you are using normal queries, so you will have to put: Code: $this->db->select('DATE_FORMAT('.$this->db->dbprefix('table').'.date, "%e-%c-%Y") as dk_date'); I actually forgot the exact useage of db prefix, so guess how I found out how to use it... I did this! ;-P
[eluser]Dam1an[/eluser]
Ah, good ol' lmgtfy to the rescue yet again Someone should rerally build a let-me-search-the-ci-user-guide-and-forums-for-you app as well
|
Welcome Guest, Not a member yet? Register Sign In |