SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast webmasts's Avatar
    Join Date
    Apr 2003
    Location
    usa
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tracking referrals on 3 levels

    I am trying to create a referral system. I want to have 3 level of membership type. How would I do that using php and mysql. What I'm thinking is creating two tables: one for UPLINES and another for DOWNLINES. I think I know how to track for the first level. How would I insert or put the tracking for 3 levels. And when the member logs in, they should be able to see their downlines below 3 levels and their uplines above 3 levles.

    Any suggestions would be appreciated!

  2. #2
    SHIZA
    Join Date
    Apr 2003
    Location
    Great White North
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm no clue

  3. #3
    SitePoint Member novice1's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can do it using one table (self referencing table) e.g
    As an example table with following columns
    id,
    name and any other information you care to store
    parent id.

    The parent id column will give you your upline and the downline

    for example to get an upline for user id 97

    select parent_id form table where user_id = 97.

    To get the downline

    select * form table where parentid = 97

    I hope this helps

  4. #4
    SitePoint Enthusiast webmasts's Avatar
    Join Date
    Apr 2003
    Location
    usa
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Shouldn't I create 2 separate tables? One for uplines and another for dowline?

    To store referral, what i would do is store the referers id to the upline table and the new member id to that table.

    How would i view the uplines or downlines 3 levels above or below? I think i can do the first one. But for second and third one, i'm kind of confused?

    Can you show me the select statement for 3 levels? My question is how would i relate and view them?

  5. #5
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    You can do it using 1 table only, as follow:
    CREATE TABLE members (
    member_id INT(11) NOT NULL AUTO_INCREMENT,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL,
    address VARCHAR(255) NOT NULL,
    city VARCHAR(100) NOT NULL,
    state VARCHAR(100) NOT NULL,
    postal code VARCHAR(50) NOT NULL,
    phone VARCHAR(50) NOT NULL,
    ref VARCHAR(50) NOT NULL,
    password VARCHAR(50) NOT NULL,

    upline VARCHAR(100) NOT NULL,
    level_1 VARCHAR(100) NOT NULL,
    level_2 VARCHAR(100) NOT NULL,
    level_3 VARCHAR(100) NOT NULL,
    time time NOT NULL default '00:00:00',
    timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
    ipaddress VARCHAR(50) NOT NULL,
    activated enum('Non_Active','Active') NOT NULL default 'Non_Active',
    PRIMARY KEY (member_id,ref)) TYPE=MyISAM;


    Every members will have their own url:
    http://www.Domain.com/?ref=their User Name
    And you can build million members by your Program.
    Want to see my website, please visit http://www.metodabisnisspektakuler.com/?id=nur
    Or
    http://www.metodabisnisspektakuler.com/

    I hope this helps


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •