
<?php
session_start();
$business=$_SESSION['business_id'];
include '../includes/connection.php';

if (isset($_GET['business'])) {
	$business=$_GET['business'];
	
 $sql = "SELECT * from permissions where branch_id=0 AND business_id=$business";
 
}else if (isset($_GET['branch'])){
	$branch=$_GET['branch'];
 $sql = "SELECT * from permissions where branch_id='$branch' AND business_id=$business";

}

$result = mysqli_query($conn, $sql);

         if (mysqli_num_rows($result) > 0) {
    // output data of each row
            while($row = mysqli_fetch_assoc($result)) {
                                        
                        $role_id =$row['role_id']; 
                        $role=$row['role']; 
                        ?>
                                     
                        <option value="<?php echo $role_id?>"><?php echo $role?></option>

                                    <?php   
                                }
                              } else {
echo "0 results";
}
                                       
                                        ?>

?>