title: Module permissions class error
body: <p>I have created a CheckModulePermission function in my user class which checks a module table to ensure the user has permissions to view the page. Below is the function</p>
  
  <pre><code> public function CheckModulePermissions($moduleId) {
  
          if(isset($_SESSION['userId'])) {
  
              // If the user is admin, allow regardless
  
              if($this-&gt;IsAdmin()) {
  
                  return true;
  
              }
  
              $sql = "SELECT `userModuleId`
  
                      FROM `userModules`
  
                      WHERE `userId` = " . $_SESSION['userId'] . "
  
                      AND `moduleId` = " . $moduleId . ";";
  
              mysql_select_db(DB_USER_DATABASE_NAME, $this-&gt;conn);
  
              $result = mysql_query($sql, $this-&gt;conn);
  
              $x = mysql_fetch_row($result);
  
              if($x[0] == 1) {
  
                  return true;
  
              } else {
  
                  return false;
  
              }
  
          } else {
  
              return false;
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>This works fine in all my pages except one page where it fails . I have a dropdown box and a text box which will be updated depending on the users permission. The user i am logged on as has the permission but the dropdown boxes do not appear. </p>
  
  <pre><code>if(isset($_GET['orderNumber'])) {
  
      // If post is set then update the prima reference and order status
  
      // Only if user has sufficient privileges
  
      if(isset($_POST['orderStatus'])) {
  
          if($user-&gt;CheckModulePermissions(11)) {
  
              $cid-&gt;UpdateOrderStatus($_GET['orderNumber'], $_POST['orderStatus']);
  
              $cid-&gt;UpdateOrderReference($_GET['orderNumber'], $_POST['PReference']);
  
          }
  
      }
  
  
  
  
  if($user-&gt;CheckModulePermissions(11)) {
  
                              $content .= "&lt;select name='orderStatus'&gt;
  
                              &lt;option value='1'";
  
                              if($orderDetails['status'] == 1) $content .= " selected='selected'";
  
                              $content .= "&gt;Incomplete&lt;/option&gt;
  
                              &lt;option value='2'";
  
                              if($orderDetails['status'] == 2) $content .= " selected='selected'";
  
                              $content .= "&gt;Submitted&lt;/option&gt;
  
                              &lt;option value='3'";
  
                              if($orderDetails['status'] == 3) $content .= " selected='selected'";
  
                              $content .= "&gt;Processed&lt;/option&gt;
  
                          &lt;/select&gt;";
  
                      } else {
  
                          if($orderDetails['status'] == 1) $content .= "Incomplete";
  
                          if($orderDetails['status'] == 2) $content .= "Submitted";
  
                          if($orderDetails['status'] == 3) $content .= "Processed";
  
                      }
  
                      $content .= "&lt;/td&gt;
  
                      &lt;/tr&gt;
  
                      &lt;tr&gt;
  
                          &lt;th&gt;Prima Order Number&lt;/th&gt;
  
                          &lt;td&gt;";
  
                          if($user-&gt;CheckModulePermissions(11)) {
  
                              $content .= "&lt;input type='text' name='pReference' value='" . $orderDetails['PReference'] . "' /&gt;&lt;/td&gt;
  
                              &lt;/tr&gt;
  
                              &lt;tr&gt;
  
                                  &lt;td colspan='2'&gt;&lt;input type='submit' /&gt;&lt;/td&gt;
  
                              &lt;/tr&gt;";
  
                          } else {
  
                              $content .= $orderDetails['PrimaReference'] . "&lt;/td&gt;&lt;/tr&gt;";
  
                          }
  
                          $content .= "&lt;/table&gt;
  
                  &lt;/form&gt;
  
              &lt;/td&gt;
  </code></pre>
  
  <p>Is it the logic for the dropdown box where it fails? </p>