Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Multiple Databases + ORM
  • Hi guys!
    I need to connect to different databases (on request) to execute queries.
    Let me explain further. I'm working on an API for an app that has 1 database for each client, and I wanted to know if there's a way to load databases on the fly with Fuel. All databases have the same structure so that shouldn't be an issue.
    If there's a way to connect to databases (MySQL) at request, would the ORM work?
    Hopefuly you will understand what I just wrote, if not please let me know to re-phrase it.
    Thank you very much
  • The ORM has limited support for multiple databases. You can set a connection property to make it use another than the current active connection. It should be noted though that relations don't work between connections. If both connections are available on the same server and with the same user/pass, you can set the table property to "database_name.table_name" and connections between that and the default should work with mysql at least.

Howdy, Stranger!

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

In this Discussion