<?php
include "../../inc/inc.koneksi.php";
$nokel=$_POST['tnokel'];

$text	= "SELECT max(nogol) as no_akhir FROM gol_akun WHERE nokel='$nokel'";
$sql 	= mysql_query($text);
$row	= mysql_num_rows($sql);
if ($row>0){
	$data=mysql_fetch_array($sql);	
	$no = $data['no_akhir'];
	$no_akhir = (int) substr($no, 1, 1);
	$no_akhir++;
	$kode = $nokel.$no_akhir;
	$data['nomor']	= $kode;
	echo json_encode($data);
}else{
	$data['nomor']	= $nokel.'1';
	echo json_encode($data);
}
?>