I have a site where a user can have multiple permissions (view, edit, delete, create). Each of these is stored as a tinyint(1) field in the database.
I'm looking for the best (quickest?) way to query MySQL to see if the user has the ability to see this page. Here is a snippet:
$user = mysql_real_escape_string($user);
$resultset = mysql_query("SELECT view FROM testbankAccess WHERE uid LIKE $user");
while($result = mysql_fetch_row($resultset)) {
if($result[0]=='1') { return true; }
}
return false;