Heya .... sorry for the dealy. I have got somewhere but still have a slight issue!
The code is now working but is of course showing results for all access levels when all I want is one result!
I had a think about it all and worked out the problem was with the initial variables. Because I have the 2 tables that I need to retrieve info from and need to create a variable for that...it was still only getting one result.
So I have searched and found out you can create a JOIN to select the information from 2 tables and basically make it one variable.
So now the code works but returns all results for each access level. This would obviusly look a mess and so I need to work out how to make it so it only returns the results for level 1 access first ... then if no level 1 access check and return results for level 2....and if none then to continue!
:>/ Any Ideas? im just going to have a play and see what i can come up with! :O)
Thanks for all your help. :O)
$find_access = mysql_query("SELECT user_id,lobby,shops FROM job_roles,job_positions WHERE job_roles.job_id = job_positions.id");
print "$openHTML";
$find_job = fetch("SELECT * FROM job_positions WHERE name = '$find_access[job_id]'");
$counter = 0;
while($row = mysql_fetch_array($find_access))
{
if ( ($row[lobby]== 1) AND ($row[user_id] == $username))
{
echo "show content gere for access level 1";
$counter++;
}
if ( ($row[lobby]== 2) AND ($row[user_id] == $username))
{
echo "show content gere for access level 2";
$counter++;
}
if ( ($row[lobby]== 3) AND ($row[user_id] == $username))
{
echo "show content gere for access level 3 ";
$counter++;
}
if ( ($row[lobby]== 4) AND ($row[user_id] == $username))
{
echo "show content gere for access level 4";
$counter++;
}
if ( ($row[lobby]== 0) AND ($row[user_id] == $username))
{
echo "<p><br><p><p><center>Sorry but your Access Level is not permitted for this page!"; $counter++;
}
}
echo $counter == 0?"<p><br><p><p><center>This page is a restrcited area. You do not have access!":"";
print "$closeHTML";