0

[Solved]How do I write this MYSQL query in php?

I was designing a banking system project and here I want to perform a transaction between two person, Let's say A and B, A sends money than money get reduced from sender's account and increases in receiver's account. I had performed but it was not working money get added but not updating. Sorry for my english. I am learning.

5th Apr 2021, 11:06 AM
Coderninja
4 Answers
0
No one can help until you at least share your database table structure for better view of the problem.
5th Apr 2021, 11:14 AM
Ipang
0
We cannot easily guess what is wrong without seeing the source code. Either post it here or post a link to it. One problem is clear. In bank transfers you need to perform the UPDATE statements together. If one fails then you must ROLLBACK all changes to ensure money is not lost nor wrongly added. Wrap the UPDATE statements inside a SQL transaction by using START TRANSACTION, and COMMIT or ROLLBACK statements. You can learn from the example here: http://www.phpknowhow.com/mysql/transactions/
5th Apr 2021, 1:36 PM
Brian
Brian - avatar
0
Thanks Brian for your refrence
8th Apr 2021, 3:34 PM
Coderninja
0
Thanks Ipang I already got how to perform transaction
8th Apr 2021, 3:36 PM
Coderninja