Как получить кредит деньги для всех родителей ребенка на PHP и MySQL
i am implementing chain system with auto bidding. when one user referred by parent(referral) then direct referral account have to credited with 10% of the user package amount and all parents of the direct referral credited 5% of the amount. how can i implement it. please tell me in basics not in oops. [Check this image][1] https://i.stack.imgur.com/tkU4S.jpg ---------------------------------------------------- <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> plan_id plan_amount daily_commision ----------------------------------------------------- p1 $100 0.7% p2 $250 1.0% p3 $500 1.5% p4 $1000 2% user_id password plan plan_amount referred_by income status --------------------------------------------------------- usr0 22222 p1 $100 Global $57.5 1 usr1 12345 p1 $100 usr0 $72.5 1 user2 123sad p1 $100 usr1 $135 1 user3 asdf4f p2 $250 user2 $10 1 user4 321423 p4 $1000 user2 0 1 <!-- end snippet --> here is users table user4 referred by user2 then 10% commision credited to user2 and 5% commision added to indirect referral usr1 and usr0. then user gets daily commision according to their package. daily commision is added to user only not referral. every user got their daily commission every day. please help me and save my job thanking you [1]: https://i.stack.imgur.com/tkU4S.jpg
Что я уже пробовал:
я уже пробовал это сделать, но я могу добавить комиссию только одному родителю, я не добавляю комиссию суперродителям.