System in a single folder with multiple Bds

Asked

Viewed 62 times

0

I’m finalizing an online system for patient management. The page (domain.com.br) has a login system.

If I have 3 registered users, each would have to access their respective database.

I wanted to know, if via PHP, I could do it.

  • 1

    Yes, of course you can. But, why create a database for each user? Why not put them all in the same database? It doesn’t make sense. And about the registration of users, they would be registered in normal files or in a fourth database?

  • Because every pharmacy has its patients, every patient has its recipes, etc. I think it would be more organized.

  • I thought of a separate BD for users. As soon as I logged in, I would take the user-linked bd and plug it in to upload the data from your pharmacy. So are their respective patients.

1 answer

2


It’s really not necessary to do this by creating a database for each user. You can allocate all of them in the same database. Just know how to structure the tables by placing an identifier in each line referencing the pharmacy responsible for the record.

However, if you still want to do it your way, creating a database for each pharmacy, just register the bank’s credentials along with the user’s registration. See the table below:

inserir a descrição da imagem aqui

In the model above, you can register one or several users to manage the same pharmacy.

At the moment login, after checking if the username and password match the registration, you take the pharmacy ID corresponding to the user and make a new SELECT to search the login credentials of the pharmacy database to which the user belongs. Then just open a new connection in PHP.

You can also imeplementate more features in the tables, such as a level of permission pro user, pro system identify what it can access or not. Finally.

I believe I have been clear. Any doubt, just comment.

  • That’s right, it was to create a database for each pharmacy, not for each user. Thank you!

  • Another thing: each pharmacy would have to have 3 folders separately (recipes, documents and vouchers). Have to set it dynamically also by the comic?

  • 1

    You talk about real folders or tables in the database?

  • Real folders inside FTP.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.