Currently i am tried to increment value by one but is not working while taking large length of digit.
For example..
Right now st_id is store in database like G4KZ00000001 now what i want when it's called second time then value will be increment by 1 so it would be then G4KZ00000002, G4KZ00000003 etc..
Following is my code..
Value get from DB..
$lastStconId =$last_api_record['st_consignment_id'];
Then Use following condition
if(empty($lastStconId)) {
$consignment_no = 'G4KZ00000001';
}else
{
$dataid = $last_api_record['st_consignment_id'];
$con = str_replace("G4KZ", "", $dataid);
echo $consignment_no = $con+1; // dynamic
echo $consignment_no = 'G4KZ'.$consignment_no;
}
When i print $consignment_no it's always return increment value but i want it with full string G4KZ00000002.
Aucun commentaire:
Enregistrer un commentaire