I'm working on a plate distribution system. I assigned a value to the variable $quantity
and it will say how many plates to be distributed.
$plate_prefix
and $plate_suffix
is the starting point of the number of plates to be distributed.
But there is an instance that there's a customized plate that will be between the number of plates.
Example: I need 30 plates, AAA-1001 is the start but AAA-1020 is already taken, so I need to skip AAA-1020 to get the plates AAA-1001 to AAA-1032.
$region = $_POST['region'];
$district_office = $_POST['district_office'];
$quantity = $_POST['quantity'];
$plate_prefix = $_POST['plate_prefix'];
$plate_suffix = $_POST['plate_suffix'];
$loop = 0;
while($loop < $quantity)
{
if($plate_suffix <= 9999)
{
$sql1 = mysql_query("INSERT INTO mv_plate (`plate_prefix`, `plate_suffix`, `region`, `district_office`, `status`)
VALUES ('$plate_prefix', '$plate_suffix', '$region', '$district_office', 'Available')");
$plate_suffix = $plate_suffix+1;
$loop = $loop+1;
}
else
{
$plate_prefix = ++$plate_prefix;
$plate_suffix = 1001;
}
}