Please help me to find next batch number corresponding to product code with using PHP and MySQL. My table is like below given image:
If I want to enter new batch of product RM-SO-070G then the PHP form must get new batch number accordingly.
Your SQL should look something like this ...
SELECT `some_tbl`.`batch_no` FROM `some_tbl` WHERE `some_tbl`.`product_code` = ? ORDER BY `some_tbl`.`batch_no` DESC LIMIT 1
And then once you get these results you will need to remove the
bt from the front of the
$next_batch_no = intval(substr($result_row['batch_no'], 2))++;