Jump to content

dealing with Data from mysql


Gotharious

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.