merck_delmoro Posted April 29, 2009 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...
taith Posted April 29, 2009 Share Posted April 29, 2009 just a quick part of it... $q=mysql_query("SELECT * FROM `accounts` WHERE `online`='1'"); $r=mysql_fetch_assoc($q); $numberofitems=200;#pull number from the db $itemsperuser=round($numberofitems/mysql_num_rows($q)); that'd show you how many items each user can see... you'd have to set a self updating "auto_increasing" number on the accounts table, of the order of login... to get where they stand in the list... $order=$r[2];#pulled from db $start=($itemsperuser*$order)-$itemsperuser;# $start=(100*2)-100; starts at 100, if 4 online, start would be 50, etc... $q=mysql_query("SELECT * FROM `` LIMIT $start, $itemsperuser"); something to that effect... sorta like pagination... but the "page" number comes from the order # set in the database, not in the url... 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.