I am using php form to submit student fee.if single user submit that form, everything is working fine and data saving in MySQL database.but if i use to submit that form from 5-10 different system at same time, then MySQL inserting two or three user's data only. I am using trigger for invoice_id :
CREATE TRIGGER `test_trig` BEFORE INSERT ON `student_fee_transaction_details`
FOR EACH ROW BEGIN
SET NEW.inv_no=(SELECT CONCAT(NEW.school_id,'-', SUBSTRING_INDEX( inv_no, '-', -1 ) +1 ) AS inv_number_new
FROM student_fee_transaction_details
WHERE id IN (SELECT MAX( id ) FROM student_fee_transaction_details WHERE school_id = NEW.school_id
));
END
here is my php code to insert
insert into student_fee_transaction_details (id,fine_amount,interest_amount,handling_charges,
institute_id,school_id,student_id,class_id,section_id,admission_no,fees_amount,payment_date,
payment_mode,paid_amount,inv_date,inv_ref_no,inv_no,inv_status,session,payment_bank,payment_type,
cheque_dd_no,payment_chanel,fee_due_date,cheque_dd_date,remarks,deposit_bank_id)
values('','$fine_amt','$interest_amt','$hand_charge','$ins_id','$sch_id','$stu_id','$cls_id',
'$sec_id','$adm_no','$total_fee_paid_amt','$pay_dt','Manual','$total_paid_amt','$inv_dt',
'$ref_no','1898776','Invoiced','$session','$bank_nm','$pay_type','$dd_chq_no','web',
'$fee_due_date','$dd_cheq_dt','$swipe_remarks','$deposit_bank')";
$result_inv_master = $con->query($qry_inv_master);