• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android Studio Database Design for Multi-user with Individual Records

ibweev

Lurker
I have written an app that uses php to perform Create, Read, Update, and Delete operations on a mySQL database. I would like to publish the app but I am having trouble with the database. User's should NOT be allowed to see other user's information. For instance, assume there exist a PurchaseHistoryTable and there are multiple users with separate purchase histories, please provide a resource I can use or an example to follow to learn how a user may only access his/her individual purchase history. Would an application like Firebase allow user information from the database tables to be isolated from other users?

I am sure the attached picture is poor design but the concept of having a user access his/her own information is what I am trying to convey.
 

Attachments

  • DatabaseQuestion.jpg
    DatabaseQuestion.jpg
    38.3 KB · Views: 451
Your architecture diagram shows one database for each user. This isn't really a scalable solution. The usual way of doing this is to create a user table, and tag the records of other tables with the foreign key of a specific user (UserId). This way you can extract the relevant records using the UserId.

You will also need a way of registering new users, and also logging in, with password checking.
 
Back
Top Bottom