Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
db.php with a DB configured but saving in another
  • Hey i have this problem that i dont really know how it happens, i change my db.php config in development with "fwrite" if that matters, anyway after i do that and i try to create a new user or insert another kind of data in my DB, fuel insert this data in the DB i had in the db.php before was modified, can anyone help me?
  • A config file is loaded only once, in the case of the database on the first DB call. After that it works from the loaded config in memory, it will not access the file anymore.

    Also, once an instance is created, it exists and it will be re-used, so even the loaded config will no longer be used once the DB instance is created.
  • is there a way to reaload the db.php cause i really nned to do it, and if there is not a way, can i save or insert the data (with ORM and AUTH) in a specific database?
  • For ORM (and Model_Crud), you can define the database connection to use in the model (it's a property). You can even specify different databases for read and write.

    For Auth, these are defined in the auth config files (you need 1.8/develop for that).

    For DB calls, you can pass the database name as parameter to the execute() method.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion