PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
The user permissions are stored in a table where one row is equivalent to a location (e.g. new york or boston) and the admin_files / user_files are colums thus allowing me to expand the range of user permissions without too much coding. Now I know the code below is wrong as you can refer to $row inside the foreach but can anyone give me a pointer onto how to manage this?
I'm using a mysql wrapper that returns the results in the array $row.
I'd also like to use a foreach or similar so I only have to change the sql and the new user permission variable is in use I don't want to have to edit the php in 2 places.
I could just list all the columns manually e.g. $row['admin'], $row['user'] etc but that would be less than flexible should I change any of the user permission variables.
I changed it to this, arguably more secure - just takes more editing. Would be nice to sort it out automatically though as adding the sql should be secure enough and even if someone did manage to set a "new" permission I'd have to tell the site to actually do something with it first.