I am setting up a MySQL database to hold multi level referrals.
Currently I am setting up the referral table to hold the userID#, Level2ID, Level3ID, Level4ID
When a new user is entered into the system I can do a build for this table using
[FONT=Times New Roman]$result = mysql_query("SELECT * FROM REFERRAL WHERE userID='$referralID'");
$SQL = " INSERT INTO REFERRAL";
$SQL = $SQL . " (userID, Level2ID, Level3ID, Level4ID) VALUES ";
$SQL = $SQL . " ('$usrID','$result[0]','$result[1]','$result[2]') ";
[/FONT]
This will also allow me to query the database once to do commission payouts using a while loop to get my counts.
😕 Is this the best way to set up the database and queries or would there be another setup that could give me the data and yet still not over work the process with multiple queries?
Thanks for any advise you can provide. 🙂