Quy Hai Pham Thu Aug 25 05:05:42 -0400 2011

Subject: I want to use the database prefix. how ?

exam :
" tbl_users" -> model "tbl_users"
but i want "tbl_users " -> model "users"

like wordpress wp_users

thank you !


Clay vanSchalkwijk Wed Sep 07 17:14:42 -0400 2011

You can specify the table name in the model:

1 <?php
2 class User extends ActiveRecord\Model
3 {
4   static $table_name = 'wp_users';
5 }

You can't set a global prefix to all tables.

Ivan Zhuravlev Tue Nov 20 15:53:26 -0500 2012

sorry for necroposting, but I have an idea...

define('PREFIX','someprefix_');
define('TABLE_NAME',PREFIX.'tablename');
class User extends ActiveRecord\Model {
static $table_name = TABLE_NAME;
}

Bill Zhao Thu Nov 28 05:41:35 -0500 2013
<br>

(1-3/3)