text: Q:
  
  Display button based on database role
  
  I have a MySQL database with a PHP frontend. Is possible in PHP to create something like admin permission on button? Can i put on my "download" button permission to only admin can access it? (only admin can download excel table with some information)
  Sorry for my bad English.
  
  A:
  
  STEP-1: When you validate user login successfully, assign some flag like
   $_SESSION['flag'] = "user";. And do the same for admin like: $_SESSION['flag'] = "admin";
  <?php
     ob_start();
     session_start();
     ......
     // login successful, then assign session 
     $_SESSION['flag'] = "admin";   
     // or for normal user
     $_SESSION['flag'] = "user";
  
  STEP-2: Use this session variable to identify is user is admin or normal user and show or hide the download button like:
  <?php 
    ob_start();
    session_start();
  
    if(isset($_SESSION['flag']) && !empty($_SESSION['flag']) && $_SESSION['flag']=="admin"){
         // code here for admin - show download button as you want!
         echo "<button id='btn_download'> Download </button>";
    } // else { // code here for normal user }
  
  ?>
  
  