Ello,
I've written a set of php scripts that populate and control a marketing matrix (contained in a mysql database).
The problem that I need to fix now is that I need to be able to show each user in a user's downline. My user table is as follows:
m_uid - unique user id, also serves as the sponsor ID for the user
... (details about the user, nothing important)
m_dsponid - sponsor ID of the person that the user signed up under directly.
naturally, each signup (user) is on their own row in the table
Example:
Joe Smith gives his friend Alan his sponsor ID (joe's user id).
Alan goes and signs up under Joe with his ID 123. 123 would be stored under m_dsponid on Alan's row. Alan is assigned a random userID of 124.
Alan gives his sponsor ID of 124 to Kelly, and she signs up with Alan as her direct sponsor.
But, she also has signed up under Joe Smith's matrix, because Joe is Alan's direct sponsor.
What I need is somehow to compare the m_dsponid field to create the full downline of Joe Smith, which would show Alan in position 1 under Joe, then show Kelly in position 1 under Alan, and position 2 under Joe.
out of breath