views:

48

answers:

0

i want to display all users which are below my status.

the lead_id shows my id if i'm the manager. all users when registering will have to put the person in charge id(lead-id) but in my case, i'm getting only users with my id.

e.g

id name leadid

1 xxx 0

2 aa 1

3 sdd 1

4 fdfs 2

5 fdss s 2

6 fdgd 3

7 erte 4

8 ewr 4

9 fsdrt 4

10 ytr 5

id 1 can view all users

id 2 can view user 4 5 7 8 9 10

id 3 can view 6

id 4 can view 7 8 9

i wish to display all users for each a manager is associated.. for e.g an hr manager needs to gets all his staff regarding hr, but i cant process it

i've 3 table with 1 user providing user info and 1 for dept_user and 1 for department. the dept_user table consists of user_id, dept_id, lead_id and role. when a user register, he needs to put lead_id which is for the user in charge of the person registering and the role specifies either staff manager or team leader.. A manager can view all the the teamleaders and the users associated with the teamleader.

manager for role 3 and team leader for role2

//get userid from login session

  $memberid = $_SESSION['SESS_MEMBER_ID'];

//get role from session
$role = $_SESSION['SESS_ROLE_ID'] 

    while($res = mysql_fetch_array($role)){
 if($role=='3'){



 $teamleader = mysql_query("select userid from dept_user where lead_id='$member_id'");

         while ($data = mysql_fetch_assoc($teamleader)) {
         $user = mysql_query("select firstname, lastname, email from user where userid in(select userid from dept_user where lead_id=$data)");
            $result = mysql_query($user);
            print $result;
                }
    }
    else if ($role=='2'){
    $user = mysql_query("select firstname, lastname, email from user where userid in(select userid from dept_user where lead_id='$member_id'");
    print $user;
    }
}