merck_delmoro Posted April 29, 2009 Share Posted April 29, 2009 Can any body knows how to do it???? please help me into this problem Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 29, 2009 Share Posted April 29, 2009 More details please. What are you trying to do? Quote Link to comment Share on other sites More sharing options...
merck_delmoro Posted April 29, 2009 Author Share Posted April 29, 2009 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???? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 29, 2009 Share Posted April 29, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.