Jump to content

How to view the database and distribute it into different login users using PHP


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

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...

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.