Hello,
I am really really stuck on a small project im working on and have been at it now for the past 12 hours. lol
I am trying to set up a restrcited page for my admins and have the following:
$find_access = fetch ("SELECT * FROM job_roles WHERE user_id = '$username'");
$find_job = fetch ("SELECT * FROM job_positions WHERE name = '$find_access[job_title]'");
print "$openHTML";
if ($find_job) {
if ( $find_job[lobby]== 1) {
echo "show page content gere for access level 1";
}
if ( $find_job[lobby]== 2) {
echo "show page content gere for access level 2";
}
if ( $find_job[lobby]== 3) {
echo "show page content gere for access level 3 ";
}
if ( $find_job[lobby]== 4) {
echo "show page content gere for access level 4";
}
if ( $find_job[lobby]== 0) {
echo "<p><br><p><p><center>Sorry but your Access Level is not permitted for this page!";
}
}
if (!$find_job) {
echo "<p><br><p><p><center>This page is a restrcited area. You do not have access!";
}
print "$closeHTML";
?>
The problem is that for some reason it will only return 1 result of jobs for the user. I want to be able to allocate more than one position to my admins and therefore have the code find all job positions allocated to that member and then allow the highest level.
.... so say for example ... one admin has the job position of technical support and moderator! Tech support is level 1 (highest) and moderator is level 4! By using this method the code only seems to pick up the first job allocated to that member in the database and wont check all job positions!
Does this make sense?
I know that the while statement selects all rows where the command is positive but I gave it a quick go and it didnt work.
Can anyone tell me why it will only return and check against one result and not compare these variables against all rows that are true???? And if there is a way around this?
Thanks
Justin