Gotharious Posted November 4, 2011 Share Posted November 4, 2011 Hello there, I'm making this website, it is some kind of multi level marketing company, the point is, I want two things 1. When adding a new member, I want php to check if there are 2 users with the same recruiter ID or not, so if there is 2, the member can't be added, if there is less, then it can be added 3. when doing an echo, I want it to search for members associated with a certain member and calculate a commission.. I was thinking about making it by ID of a member, but that would mean only people who has his ID as a recruiter ID will be counted, and not the people they recruited Example: A recruited B, and B recruited C, and C recruited D the commission is $10 per recruit then A would get $30 and B would get $20 and C gets $10 is that possible? Quote Link to comment https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/ Share on other sites More sharing options...
trq Posted November 4, 2011 Share Posted November 4, 2011 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/#findComment-1285075 Share on other sites More sharing options...
Gotharious Posted November 4, 2011 Author Share Posted November 4, 2011 I would really be grateful for any help about this, a link perhaps to a code, cause I don't know the keywords to search for in google about this Quote Link to comment https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/#findComment-1285084 Share on other sites More sharing options...
trq Posted November 4, 2011 Share Posted November 4, 2011 It's probably far too specific a question to find a tutorial on the exact subject. The trick is to try and visualize a suitable data structure. I can see a hierarchy working for this type of problem. Where A would be the parent of B, B would then be the parent of C etc. There are lots of different ways of building hierarchies of data. My preferred method is what is know as a 'Nested Set'. If you search for Mysql Nested Set examples you might have more luck. Quote Link to comment https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/#findComment-1285094 Share on other sites More sharing options...
Gotharious Posted November 4, 2011 Author Share Posted November 4, 2011 Thanks a lot Thorpe, will give that a try Quote Link to comment https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/#findComment-1285100 Share on other sites More sharing options...
Gotharious Posted November 5, 2011 Author Share Posted November 5, 2011 Thanks, that worked Quote Link to comment https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/#findComment-1285333 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.