0
How to fetch data from more than 1 database linked with another database
.I am linking a new database with every admin and in that database the admin's private data will be saved...like one admin whose name is Jack, his data will be stored in master database now he is linked with new database name'jack' in jack database jacks all private tables and his employee details and so on will be saved ... now when an employee will log in with his mobile no. and password i have to search in all database similar to jack database how can i reduce this
8 Respostas
+ 3
why you need 2 DB?
+ 2
@Swapnil Singh, I have an idea, I don't know if it's worth implementing, but I just wanted to give you an alternative.
Add a new field in the user login table e.g. "database_name" and after a successful login your program switch to using the database from that field.
For example, there's an employee named Jane who is Jack's employee, so in the user login table the record for Jane has a database_name field with the value "Jack". After Jane entered her login information the system should switch to using the Jack database.
Hth, cmiiw
+ 1
thats a good idea ...or i can give every employee a employee id than it will be esily fetch...
+ 1
@Swapnil, yeah, that would work too, so I was also thinking a simpler way to do it like having admin_id field in the employee table, which is a foreign key reference to admin table, that is, if you only need to relate admins and employees, but you said each admin has private tables, and data, so I guess your choice to use one database for each admin is the right way to go.
Somehow I guess I don't really understand what your system was designed for, the subscription part especially. Anyways, good luck on the project mate :+)
+ 1
@Swapnil, is that a question, coz if it is, I don't know how they achieve such performance, it's beyond my knowledge :)
0
@mantas i need every admin who buy subscription from me will have separate database thats why i am using if some buy another subscription from me than one new fiel will create in admin panel then a new database will be created which stores only his data and only his employee
0
how google facebook or other bigcompanies stores username and password ...if they use only one table then the query will be slow bcoz millions of row will be created how they perform log in so fast
0
thankyou @ipang for solving my query