samedi 21 juillet 2018

If condition doesn't work while similar condition work for different roles (Manager- Employee..etc)?

I have 3 pages that direct the user to the final result, For example: Log in (As manager) -> Press (View Request) -> show query result . this line is working successfully with the below code :

else if ( $role == 'Manager'){
$boxData = array(
   "View Requests" => "listOfRequests.php",
   "Annual Report" => "",
   "Manage Users" => "",
   "View Assigned Assets" => "listOfRequests.php" );   

in (listOfRequests.php) page i have this code:

if ($role == 'Manager' && isset($_GET['click'])){
  if ($_GET['click'] == 'View Requests'){
  $sql="SELECT users.user_id, users.first_name, users.middle_name, users.last_name, request.user_id, request.location, request.asset_kind, request.Status
  FROM users
  INNER JOIN request ON users.user_id=request.user_id AND role='Manager';";
  $records=mysql_query($sql);
  ViewRequest($records); 
  }}

But when i have 4 pages it doesn't shows the query result. For example, when i have the following : Log in (As Admin) -> Pressing (Request) -> pressing (List of request) -> it should shows the query result here but it doesn't work with the following :

if ($role == 'Admin' && isset($_GET['click'])){
 if ($_GET['click'] == 'List of request'){
  $sql="SELECT * FROM request;";
  $records=mysql_query($sql);
  AdminListOfRequest($records);
  }}

it opens the page successfully but without any data. The mistake is on the first line of (IF Condition) but i can not decide where is it exactly.

Aucun commentaire:

Enregistrer un commentaire