Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/250456-dealing-with-data-from-mysql/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.