php - How to update all users when admin login? -


I am preparing an MLM website in which all users must update single foot income, direct income and referral income When admin login I used the same code for different updates for each user.

For example: I am a user and I am going to check my earnings, I have to log in and check it ... so log in at the time I earn all the user's earnings in the database So if the user wants to see the updated earnings, then they will have to sing and login again every time ... simple But in this case when users login ... they are passing a user-end in the session ... through which I am synchronizing all the income.

All this is about a user of arbitrary ... and maybe they want many users and codes for each.

But when we take about administration, then?

They have to see the earnings of all users on the same page. I need help in that ... I think I have to turn on all code, single leg income, direct income and referal income in the loop ... so all users have to select one and all revenue updates after one.

A little confused ... please help ... I thought I would explain the best of my knowledge ...

Code here:

Direct Earnings:

  & lt ;? Php $ userid = $ _ session ['userid']; $ Sql ​​= "Select * Individual where userid = '$ userid'"; $ Query = mysqli_query ($ conn, $ sql); While ($ line = mysqli_fetch_array ($ query)) {$ id = $ row ['id']; } $ Sql ​​= "SELECT * to private where id & gt; '$ id' range 10"; $ Query = mysqli_query ($ cone, $ sql); $ One = 0; While ($ line = mysqli_fetch_array ($ query)) {$ userid = $ row ['id']; $ User name = $ line ['USERID']; $ Sponserid = $ line ['sponserid']; $ Amount = $ line ['amount']; If ($ line ['sum'] == 2500) {$ total1 = 2500; } And if ($ line ['sum'] == 5000) {$ total1 = 5000; } And if ($ line ['sum'] == 10000) {$ total1 = 10000; } And {$ total1 = 0; } $ I = array (0.05,0.02,0.01,0.005,0.0025.00.0025.00.0025.00.00.00.0025.00.0025); $ Total [] = $ total1 * $ i [$ a]; A ++ $; $ Level_income = array_sum ($ total); } $ Qry = "Personal set direct_income = 'update $ levels_income' where userid = '". $ _ Session ['userid'] "'"; Mysqli_query ($ angle, $ qry); $ _SESSION ['level_income'] = $ level_income; ? & Gt;  

Referral Revenue Code

  & lt; Includes php ('head.php'); $ Query = "Select userid, personal from amount WHERE sponsor = '$ _ session [userid]'"; $ Result = mysqli_query ($ conn, $ query); While ($ line = mysqli_fetch_array ($ result) or die (mysqli_error ($ conn))) {$ total [] = $ line ['amount']; $ Earn = array_sum ($ total); $ _SESSION ['refral_income'] = $ earn * 0.05; $ Qry = "Personal Set Refresh_Income = '$ _ session [refral_income]' where userid = '". $ _ Session ['userid'] "'"; }? & Gt;  

Single Leg Income Code:

  & lt ;? Includes php ('head.php'); $ Sql ​​= "Select * Personal from where userid = '$ _ session [userid]'"; $ Query = mysqli_query ($ conn, $ sql); While ($ line = mysqli_fetch_array ($ query)) {$ id = $ row ['id']; } $ Sql ​​= "SELECT * from private where id & gt; '$ id'"; $ Query = mysqli_query ($ cone, $ sql); While ($ line = mysqli_fetch_array ($ query)) {$ userid = $ row ['id']; $ User name = $ line ['USERID']; $ Full name = $ line ['full name']; $ Sponserid = $ line ['sponserid']; $ Amount = $ line ['amount']; If ($ line ['zodiac]] == 2500) {$ total1 = 10; } And if ($ line ['sum'] == 5000) {$ total1 = 20; } And if ($ line ['sum'] == 10000) {$ total1 = 40; } And {$ total1 = 0; } $ Total [] = $ total1; $ Single_leg_income = array_sum ($ total); } $ _SESSION ['earnings'] = $ single_leg_income; $ Qry = "Personal Set Single _leg_income = '$ single_leg_income update' where userid = '". $ _ Session ['userid'] "'"; Mysqli_query ($ angle, $ qry); ? & Gt; I am using simple coding, and I am trying to use the PDO ... but before actually want to know ... I have a user How can I do this as an admin in the form of a page? 

Thank you.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -