In a basic accounting scenario, you first insert a transaction in a transaction table. That table contains the amount of the transaction, as well as the credit and debit accounts. You then update the balance of each account using two update statements. All of these operations need to be atomic - that is -they all must succeed or else be rolled back. So you need to incorporate transaction management.
Thanks...i have an idea of this. But i would like to know how you transfer it into coding and usually a webpage where i can do manual transactions transfers for any desired amount and this should update into the users balance table.
Here's a very basic method. Note that this is just pseudocode - you'll need to work out the actual code (I assume you've learned how in your course studies). Keep in mind this is a very simplified workflow - a real bank transaction would be MUCH more complex.
Create a form that has fields for debit account, credit account, amount
In your script, assign the values from the form to local variables
I'll assume you have an account balance table 'acct_bal'. Have a journal table to store those values along with the date and autonumber transaction id.
INSERT into journal (credit_acct, debit_acct, amount, trans_date) VALUES ($credit_acct, $debit_acct, $amount, NOW())
Get the transaction_id ($trans_id) from the INSERT statement- the method depends on which MySQL interface you are using.
UPDATE acct_bal SET balance = (balance + $amount) WHERE acct_id = $debit_acct
UPDATE acct_bal SET balance = (balance - $amount) WHERE acct_id = $credit_acct
Rollback on any SQL error else Commit Trans.