<?php
include "koneksi.php";
$data = "SELECT max(nomor) as nomor from tbl_permohonan";
$sql = mysql_query($data);
if($sql === FALSE) {
die(mysql_error()); // TODO: better error handling
}
$i= mysql_fetch_array($sql);
// ID OTOMATIS//***************************************************
$kodeawal=substr($i['nomor'],2,7)+1;
if($kodeawal<10){
$kode='190281000'.$kodeawal;
}elseif($kodeawal > 9 && $kodeawal <=99){
$kode='19028100'.$kodeawal;
}else{
$kode='1902810'.$kodeawal;
}
?>
I think I wrong on $kodeawal=substr($i['nomor'],2,7)+1;
, but I dont know where is the bug. So help me fix it. Thanks !
Aucun commentaire:
Enregistrer un commentaire