For some reason, you need to get the database's maximum ID value. So the PHP gets the largest ID code for the database. The ID inside of this is the maximum ID to get. If it is another field please fill in the other fields
Gets the value of the largest ID in the database
$fh = mysql_query ("Select MAX (ID) from master");
$c _echo = mysql_fetch_array ($FH);
Var_dump ($c _echo);
Then get the employee number
$str = "QB". Str_pad (($maxid [0]["Max (ID)"]+1), 5, "0″,str_pad_left");
The Str_pad () function fills a string with the specified length.
Grammar Str_pad The (string, length,pad_string,pad_type) parameter describes the string required. Specifies the string to populate. Length required. Specifies the length of the new string. If the value is less than the length of the original string, no action is made. Pad_string is optional. Specifies the string to use for padding. The default is blank. Pad_type is optional. Specify the padding string over there. Possible values: str_pad_both– are populated to both ends of the string. If it is not an even number, the right side gets an extra fill. str_pad_left– fills the left side of the string. The str_pad_right– is populated to the right of the string. This is the default.
This completes the product, the employees are tried
PHP generates employee number, product number