acctman Posted September 6, 2008 Share Posted September 6, 2008 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. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 6, 2008 Share Posted September 6, 2008 Unless you're going to have multiple per user, you don't need a separeate table. Quote Link to comment Share on other sites More sharing options...
acctman Posted September 6, 2008 Author Share Posted September 6, 2008 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 Quote Link to comment Share on other sites More sharing options...
steveclondon Posted September 6, 2008 Share Posted September 6, 2008 add a referal id to the member table, so if member 200 had added 100 users, those users would all have 200 in there referal id. Then had the ip etc in the member table Quote Link to comment Share on other sites More sharing options...
acctman Posted September 7, 2008 Author Share Posted September 7, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.