Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord: dbprefix on tables inside MySQL functions
#1

[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.
#2

[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
#3

[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 Wink
#4

[eluser]Phil Sturgeon[/eluser]
I thought you'd like that.
#5

[eluser]Unknown[/eluser]
.




Theme © iAndrew 2016 - Forum software by © MyBB