Link to home
Start Free TrialLog in
Avatar of 3xtr3m3d
3xtr3m3d

asked on

php array help

Hi

im storing records like this

 User generated image
section contains the office numbers which this file should available and my session contains the office number which user logged in

so how to check whether session office number is contain in section or not?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is information that might be helpful.  Read the top five responses and you'll be way ahead in understanding data base design.
http://lmgtfy.com/?q=Should+I+Normalize+My+Database

;-)

HTH, ~Ray
Assuming, section is an array, here is the piece of code which returns trur if logged in user section number is present in the section.

sessionSectionVar - is the section number of user stored in the session.

<?php
function myfunction($ae)
{
if ($ae===sessionSectionVar)
  {
  return true;
  }
return false;
}
print_r(array_filter($ae,"myfunction"));
?>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 3xtr3m3d
3xtr3m3d

ASKER

yeah currently i have 15 offices and also that can be increased in future
15 offices or 200 or 20,000 offices will not really matter.  If your tables are indexed correctly the size and speed of the app will be just fine.  Anyway thanks for the points and good luck with it, ~Ray