shaddf Posted November 27, 2015 Share Posted November 27, 2015 Is this allowed in mysql transactions;Can i insert conditionally into different tablesĀ by different users to insert data : i have tried this inside a stored procedure,but can someone correct me if it is good approach: START TRANSACTION; INSERT INTO minderstbl(m_date,m_notes )VALUES(in_date,in_remindernotes); SELECT Rm_id INTO l_rem_id FROM minderstbl where m_date=in_date and m_notes=in_remindernotes limit 1; IF in_status = 1 THEN INSERT INTO i_ndertbl(id,Doc_id,frq_no,eq_text )VALUES(l_rem_id,in_doctitleid,in_freq_no,in_freq_text); ELSEIF in_status = 2 THEN INSERT INTO nderstbl(ct_id,em_id,eq_no,q_text )VALUES(in_compid,l_rem_id ,in_freq_no,in_freq_text); ELSEIF in_status = 3 THEN INSERT INTO rstbl(m_id,q_no,q_text )VALUES(l_rem_id ,in_freq_no,in_freq_text); END IF; if l_rem_id !='' then SELECT l_rem_id ; end if; COMMIT; Quote Link to comment https://forums.phpfreaks.com/topic/299594-how-to-use-transactions/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.