• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

I'll be having two different CodeIgniter installations sharing the same database but different tables. Is this a situation where you would want to use the dbprefix property when configuring database connections? From my understanding dbprefix prepends a string to each table name when running queries. Is the point of this simply to shorten code rather than saying app1_tablename, app2_tablename, etc. or is there a stronger purpose.

My idea was just to prefix each table name manually when creating them in MySQL like app1_users, app2_users, etc.

What would be the best way to go about this? I guess I'm just not understanding the purpose of dbprefix when I can take care of it self.

It's just a tool to make your life easier, if you want to use it. It does exactly that - adds the prefix to table names. Don't over think about what its "intended" purpose might be. In some situations, prefixes help if there is a potential conflict in table names.

Note that it's only for active record, and will not affect using $this->db->query() manually. But yeah, it's up to you if you want to use it or not.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.