Hi All
Ok this will be very complicated to explain so bare with me ad if u eed any further info for helping me just ask!
Using: PHP and MySQL
Problem:
I have 2 tables Users and Users_Leave_Apps; Leave Applications are applied by each and every user but not everybody can approve the leave application...this was solved by adding a new field within the Users table called Reports_to which basically stores another User ID! Then when loading the approving section only those falling under your ID will appear. That worked fine as i only had to run a normal SQL query to retrieve the list.
Now the company structure has changed and My kind boss asked me to change the structure; meaning... he wants me to list all the Employees who Fall under Jack and if one of those has other employees who fall under him those are shown too! this can keep going on for ages.
eg:
Nick falls under Jack; and Jack falls under Joe;
If i'm Joe and i go under approve list i need to see all applications of Jack and Nick;
Whereas if i'm Jack i see only Nicks applications;
How can i create a function that will go thru the list and creating a list of users. I will then only have to go through the list of users and select their applications!
Any help would be greaty apprecited!
Thanks
Nick
Ok this will be very complicated to explain so bare with me ad if u eed any further info for helping me just ask!
Using: PHP and MySQL
Problem:
I have 2 tables Users and Users_Leave_Apps; Leave Applications are applied by each and every user but not everybody can approve the leave application...this was solved by adding a new field within the Users table called Reports_to which basically stores another User ID! Then when loading the approving section only those falling under your ID will appear. That worked fine as i only had to run a normal SQL query to retrieve the list.
Now the company structure has changed and My kind boss asked me to change the structure; meaning... he wants me to list all the Employees who Fall under Jack and if one of those has other employees who fall under him those are shown too! this can keep going on for ages.
eg:
Nick falls under Jack; and Jack falls under Joe;
If i'm Joe and i go under approve list i need to see all applications of Jack and Nick;
Whereas if i'm Jack i see only Nicks applications;
How can i create a function that will go thru the list and creating a list of users. I will then only have to go through the list of users and select their applications!
Any help would be greaty apprecited!
Thanks
Nick