I have tried to reset a var $potong to start from 1 again when date = '01'
and database table is empty.
Here is my code :
$month = date('n');
$b=romanNumerals($month);
$years=date('Y');
echo"<div class='form-group'>";
$tanggal=date('d');
$s=mysql_query('SELECT * FROM preorder ORDER BY id_po DESC LIMIT 1');
while($a=mysql_fetch_array($s)){
$nomor = $a[2];
$potong = (int)substr($nomor,0,3);
$potong++;
$awal =1;
}
$kosong= mysql_num_rows($s);
if($potong == 0 || $tanggal == 01){
echo"<input type='text' class='form-control input-lg' placeholder='' name='no_po' Readonly = true value='".sprintf('%03s',$awal)."/$b/CMT/$years'>";
}
else{
echo"<input type='text' class='form-control input-lg' placeholder='' name='no_po' Readonly = true value='".sprintf('%03s',$potong)."/$b/CMT/$years'>";
}
I need suggestions, how to I can create this condition.
Thanks in advance.