Jump to content

How to call the database and distribute it into different login users


merck_delmoro

Recommended Posts

I want to create a system that the log-in users can view the database but the records that they can view is depends on the number of users online,

 

Example:

user1 log-in into the website he/she can view 100 records but when user2 log-in the records was cut into 2. user1 and user2 both view 50 records user1 view the records from the database starting from 1-50 and user2 can view database records starting from 56-100

 

the records that they can view is depending on how many of them are online into the site can you help me to solve it can you give me some ideas on how to build it????

Link to comment
Share on other sites

First, you'll need a temporary table to hold the number of users online. Or better yet, have a field in the user's table to determine if the user is online or offline. Then when determining the number of results a user can view, get the total number of users online and the total number of records. Divide it up. Determine for yourself what happens when you can't divide evenly. For example if you have 100 records and 6 users online. You can't divide 100 by 6 evenly. Then use SQL query with LIMIT keyword to get the number of entries.

 

That's the best I can do in advice. One thing I don't know is how to determine user1 and user2 etc. Would user1 be the first person who appears online or is this alphabetical? If the former, then you would need to keep track of the last login time for each user and sort by that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.