hiyerarşi döngü mysql php

0 Cevap php

benim durum altında olan tüm kullanıcıları görüntülemek istiyorum.

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.

ör

id isim leadid

1 xxx 0

2 aa 1

3 SDD 1

4 FDFs gelen 2

5 FDSS s 2

6 fdgd 3

7 erte 4

8 ewr 4

9 fsdrt 4

10 ytr 5

id 1 tüm kullanıcıları görebilirsiniz

id 2 kullanıcıya 4 5 7 8 9 10 görebilirsiniz

id 3 6 görebilirsiniz

id 4 7 8 9 görebilirsiniz

i wish to display all users for each a manager is associated.. for ör 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.

role2 için rolü 3 ve ekip lideri yöneticisi

//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;
    }
}

0 Cevap