How to make a payout system
Moderator: General Moderators
How to make a payout system
Hi,i was wondering what would be the best way to store how much a user is owed. BAsically, i need to make an admin panel that will show all the users and when they select one,their total payout will be showed up on the screen (i have the user table done). The problem i have is how would i select all the recoreds with the users id,add up the prices,and then,when the admin selects Payed/Payout or whatever,that all the entries previously selected,will get a "p" or something in the paid column. This way,the next time the admin views the payout for the person,it will tell me that there is nothing to be owed to that user?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I would make a transactions table, listing all the transactions that go to a user, from a user. That way you can use simple SQL statements to calculate the balance on their account. You could have a datetime field "paid" - when its null, it hasn't been paid, when its a valid stamp, it has been paid.
well,what i did was make 3 tables. one store all of the offers,their type and their value.once someone completed them,it would be moved to the poffer(pending) table. if the admin verified that it was complete,it would move to the coffers(completed) table. in that table,i added a new field called paid. If the offer was paid,it would have a "p" in the column. I would then select all the values for the user that dont have a "p." Now,i guess my question is:How do i select all entries which are of a specific person which dont have a p in that column.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
OK, say you have a table of users with the following fields:
1. user_id
2. user_name
3. user_password
And you have another one with offer information:
1. user_id
2. user_offer
3. user_is_closed
You can select from these two tables using a join...
1. user_id
2. user_name
3. user_password
And you have another one with offer information:
1. user_id
2. user_offer
3. user_is_closed
You can select from these two tables using a join...
Code: Select all
SELECT u.user_name, o.user_offer
FROM user_table u
INNER JOIN offers_table o
ON o.user_id = u.user_id
WHERE o.user_is_closed <> 1;
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA