Skip to content
Advertisement

Connecting to multiple MySQL database in single php app [closed]

I’m trying to connect multiple mysql databases to a single php web app. I’d like each user to be able to access a different database. Every database has same tables but I wouldn’t like userA to na able to access the data of userB, using the same app.

How do I do this for the user to login to their own database. I saw this below online which addressed similar tasks but I don’t know how to implement login into a database.

E.G.

I need your help pls. Thanks

Advertisement

Answer

I would use the main database where I store user databases. And then you could fetch user DB from the main database and connect. Pseudo code:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement