Jump to content

best table setup


acctman

Recommended Posts

i have a memberTable that stores a users IP and TimeStamp, i'm working on building a referralTable and was wonder if i should add a IP and TimeStamp table or just reference the memberTable.

 

Option 1: query the membertable for the IP and TimeStamp of when the user signed up

Option 2: store the same IP and TimeStamp in the referralTable

 

option1, would use up less database space, but add extra coding and resources to query a display of referrals

option2, less database space, less coding and less resources when displaying referrals.

 

for a few referrals option 1 might seems as the best choice, but what if a user has like 300 referrals, that would mean 300 different rows that would have to be collected with IP and TimeStamp info from the memberTable

 

can anyone offer some advice, i'm trying not to create a messy resource intense setup cause i know in the future that would become a problem.

 

another option could be to add a refby and refstatus field to the memberTable and eliminate the need for a referalTable. but if i do that does it ever become a problem when you have to many fields in a table? currently the memberTable has 48 fields.

Link to comment
Share on other sites

Unless you're going to have multiple per user, you don't need a separeate table.

 

there will be multiples. User1 can refer an unlimited amount of users. And, all the users that are referred can also refer more members too. Would it be best to just use a separate table cause User1 can have like 1000 referals, so can user2,3,4, etc

Link to comment
Share on other sites

 

Table: rate_referrals

Fields: ref_id, ref_by, ref_mem, ref_points, ref_status

 

in the members table (rate_members) i have a field called 'm_date' in which the ref_status field will need to check daily. ex. ref_status gets a default value of "0" which pending, after 30 days from the referred join date the status will change too 1. So i would have to have a cron setup to query the rate_referral table where the ref_status fields are 0 and then reference the rate_members table and check the m_date.

 

Doing that would give me an extra query step, but if I had a duplicate ref_date field in the rate_referral I would have to touch the rate_members table.

 

What do you think, i'm trying to do this the best way without having bad/slow mysql coding.

Link to comment
Share on other sites

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.