<?php
include "../../inc/inc.koneksi.php";

$kode 	= $_POST['kode'];
$kodetk = $_POST['kodetk'];

$text = "SELECT max(no_urut) as no_akhir FROM jurpsb WHERE kode_ps='$kode' AND kode_tk='$kodetk' ORDER BY no_urut";
$sql  = mysql_query($text);
$row  = mysql_num_rows($sql);

if ($row>0){
	$data=mysql_fetch_array($sql);
	$nomor = $data['no_akhir']+1;
	$data['nourut']= $nomor;
	echo json_encode($data);
}else{
	$data['nourut']= '1';
	echo json_encode($data);
}
?>