I have these codes:
//ambil nomor surat maksimum pada tabel surat_keterangan
$query = "SELECT MAX(nomor_surat) as noMax FROM surat_keterangan";
$result = mysqli_query($link,$query);
$row = mysqli_fetch_array($result);
$nomor = $row['noMax'];
//ambil karakter nomor urut surat paling kiri sebanyak 1 karakter (0, 1)
$noUrut = (int) substr($nomor, 0, 1);
$noUrut++;
//mengambil bulan dan tahun dari tanggal surat
$bulan = substr($tgl_surat,3,2);
$tahun = substr($tgl_surat,6,4);
//membuat nomor surat
$nomor_surat = $noUrut."/SK/".$bulan."/DPK3/".$tahun;
the output will be
1/SK/06/DPK3/2014.
the first string (1) will add every time I insert data. I have tried until 10/SK/06/DPK3/2014, but when I continued to input, the output still
10/SK/06/DPK3/2014, not 11/SK/06/DPK3/2014.
is there another way? thank you for every responses and answers.