<?php 	
require_once '../../Server/connection.php';

$sql = "SELECT pos_id,name FROM positions";

$result = $connect12->query($sql);

$output = array('data' => array());

if($result->num_rows > 0) { 

 // $row = $result->fetch_array();
 $active = ""; 
 $x = 1;

 while($row = $result->fetch_array()){
 	$categoriesId = $row['pos_id'];
	
	
	$button = '<!-- Single button -->
	<div class="btn-group">
	    <a type="button" class="btn btn-primary" data-toggle="modal"  data-target="#MyModal" data-id='.$categoriesId.' id="getUser11"> <i class="glyphicon glyphicon-eye-open"></i></a>
	</div>';
	
	
	$button1 = '<!-- Single button -->
	<div class="btn-group">
	    <a type="button" class="btn btn-primary" data-toggle="modal" id="editCategoriesModalBtn" data-target="#editCategoriesModal" onclick="editCategories('.$categoriesId.')"> <i class="glyphicon glyphicon-edit"></i></a>
	</div>';
	
	$button2 = '<!-- Single button -->
	<div class="btn-group">
	<a type="button" class="btn btn-primary" data-toggle="modal" data-target="#removeCategoriesModal" id="removeCategoriesModalBtn" onclick="removeCategories('.$categoriesId.')"> <i class="glyphicon glyphicon-trash"></i></a>
	
	</div>';
	
	
	//$imageUrl = substr($row['vehicle_image'], 3);
	
	//$vehImage = "<img class='img-round' src='".$imageUrl."' style='height:40px; width:70px;'  />";

 	$output['data'][] = array( 

	    $x,
 		
 		$row['name'], 
 		
 		$button,
        $button1,
        $button2  		
 		); 
        
		$x++;
		
 } // /while 

}// if num_rows

$connect12->close();

echo json_encode($output);