<?php
session_start();
include '../../Connections/connect_mysql.php';
?>

<table id="tableposi" class="table table-striped table-bordered">
	<thead>
		<tr>
			<th>รหัสตำแหน่ง</th>
			<th>ชื่อตำแหน่ง</th>
			<th>แก้ไข/ลบ</th>
		</tr>
	</thead>
	<?php $sql_posi = 'SELECT * FROM position_tb'; 
          $objposi = mysql_query($sql_posi)?>
	<tbody>
	<?php while ($rowposi = mysql_fetch_array($objposi)) { 
		$posid = $rowposi['posid'];
		$posicode = $rowposi['poscode'];
		$posiname = $rowposi['posname'];
		?>

		<tr>
			<td><?php echo $posicode;?></td>
			<td><?php echo $posiname;?></td>
			<td><button type="button" class="btn btn-warning btn-xs" onclick="javascript:btn_edit_posi(<?=$posid ?>);"><i class="fa fa-pencil"></i> แก้ไข</button>
				<button type="button" class="btn btn-danger btn-xs" onclick="javascript:btn_delete_posi(<?=$posid ?>,'<?=$posiname ?>');"><i class="fa fa-trash-o"></i> ลบ</button>
			</td>
		</tr>
	<?php }mysql_close($c); ?>
	</tbody>
</table>
<script>
    $(function() {
       $("#tableposi").DataTable();
    });
</script>