+ 1
How can I create a column(name= balance) which increase and decrease on deposit and withdrawal. By php /js.
I have 3 column named depositAmt, withdrawAmt, balance, i wants column balance to increase in value when deposit and decrease in value when withdraw is done. By php/js please.
2 Answers
+ 1
I think you need to improve context clarity here. A word "column" can have multiple interpretation. It can be a database table column, a HTML table column.
If you meant database table column, then please use SQL in tags, if you meant HTML table column then use HTML in tags đ
0
Do the following:
SELECT balance from tablename ORDER BY tableID column DESC
LIMIT 1. From this you will get the last balance value.
Then take the value of depositAmt that is from your form the add to balance. Then INSERT INTO tablename ('depositAmt', 'balance') VALUES ('$fromyour input', '$results of balance and depositAmt addition')