[eluser]d1a8lo24[/eluser]
Hello everyone i need some help figuring out how to get data in a particular way.
These are the fields that I have in the table from where ill be getting the data.
Fields:
transaction_id
transaction_type
transaction_amount
So basically the transaction type is the one that will tell me if its a purchase, credit or a payment, The transaction amount can have either negative or regular values.
Now I know how to use the sum to get a full total which it works fine.
But I want something like the banks have which is a table in which you have the transaction and next to it you will have a balance like below.
Now I know how to do a loop and output everything except how to do the balance for each row.
ATM deposit - 05/21/2011 - $10.00 - balance - $25.00
Purchase - 05/21/2011 - $5.00 - Balance - $15.00
Deposit - 05/21/2011 - $20.00 - Balance $20.00
Is it possible to get this from 1 table like I have or do i need something else. Or can this be done using in code.
If anyone can help me with an example either in MySQL or in php code I will really appreciated.