System in a single folder, with multiple BDs

0

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

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

I wanted to know if using PHP, I could do that.

    
asked by anonymous 16.09.2017 / 01:32

1 answer

2

You do not really need to do this by creating a database for each user. You can allocate all in the same bank. Just know how to structure the tables by placing an identifier on each line that references the pharmacy responsible for the registration.

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

In the template above, you can enroll one or more users to manage the same pharmacy.

At the moment login, after verifying that the user name and password hit the register, you take the corresponding pharmacy ID from the user and make a new SELECT to search the login credentials of the pharmacy database to which the user user belongs. Then just open a new connection in PHP.

You can also implement more features in the tables, such as a level of permission for the user, pro system to identify what they can access or not. Anyway.

I think I made myself clear. Any questions, just comment.

    
16.09.2017 / 07:23