jaymc Posted January 27, 2008 Share Posted January 27, 2008 Ok, I have already asked this question about a month ago but didnt really get an answer, I dont think i explained well enough so here goes I have a whosonline page which displays members online. Lets says there are 500 members online and I display 10 per page. So, the first page displays 10 members currently online, I click next page and I get the next 10 and so on Now, I am on page 3, I go away for 5 minutes and come back to the computer. By then 100 people have went offline therefor the order I was displaying by has rejuggled. here is an example At 5.30PM 1 2 3 4 5 6 7 8 9 10 At 5:35pm 3 members 3,7,9 have went off line, meaning this 1 2 4 5 6 8 10 Which then becomes this to meet the requirments of LIMIT 0,10 1 // #1 2 // #2 4 // #3 5 // #4 6 // #5 8 // #6 10 // #7 11 // #8 12 // #9 13 // #10 My problem is, if I click next/back I sometimes get a few people on that page that where on the other page beucase people have dropped offline thus they take there place to fill the gaps I cant think of how I can overcome this? It seems quite simple but in practice.. a real pain!! I hope I have explained the problem well enough, any ideas to prevent this. What is the the standard way to display member online times which allow consistancy Quote Link to comment https://forums.phpfreaks.com/topic/88069-whos-online/ Share on other sites More sharing options...
jaymc Posted January 31, 2008 Author Share Posted January 31, 2008 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/88069-whos-online/#findComment-454786 Share on other sites More sharing options...
cooldude832 Posted January 31, 2008 Share Posted January 31, 2008 pagination scripts that pull off mysql shouldn't have predefined limits, they should be defined at the time the page loads I.e You carry across the page number and number of results per page instead of results 20-30 Example http://www.mysite.com/page.php?start=20&end=30 (This is bad coding for pagination) http://www.mysite.com/page.php?page=2&resutls_per_page = 10 (This is much better) it be adventaous to see your script to see how to help this, but I see it must be some big secret Quote Link to comment https://forums.phpfreaks.com/topic/88069-whos-online/#findComment-454810 Share on other sites More sharing options...
jaymc Posted February 1, 2008 Author Share Posted February 1, 2008 I dont get how that would resolve this problem or better coding practice? Can you explain/elaborate a bit? Quote Link to comment https://forums.phpfreaks.com/topic/88069-whos-online/#findComment-455430 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.