• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dynamically setting dbprefix?

I have an application where I need to have the dbprefix set dynamically when a user logs in. My thought was that I could set the dbprefix value to the user session and the queries in the models would simply read the session. My problem is that I'm not sure how to dynamically set the dbprefix on the fly. Is there a call I can make to set the current config to change the dbprefix value? I imagine that I could just set a variable to use in the statements, but it seems like a better idea to maintain the coding standard of using the dbprefix feature that ci has.

try this
$this->db->dbprefix='your prefix';

Read the users guide!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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