Results 1 to 3 of 3
Mar 21, 2011, 11:59 #1
- Join Date
- Mar 2011
- Manchester, UK
- 0 Post(s)
- 0 Thread(s)
Search MySQL Table That Has More Than 1 Value?
I'm currently stuck on an issue i have which i will try and explain to the best of my ability and try and explain what I'm trying to achieve.
Right I'm in the middle of creating an affiliate network using PHP & MySQL. I have a table called Programs which looks like the following:
Now what im trying to do is do it so affiliates need to apply to the program in order to be able to run it. Now i'm trying to think of the best way in order to do this and one idea i had was to add 2 new fields in the table called Programs at the end and call them 'PendingAffiliates' and 'ApprovedAffiliates' and for example lets say affiliate id 2,7,24 and 29 applied to run programid 1 and affiliate id 1,3,4,5 where approved to run the program the table would now look like this:
Now the problem i have is i dont know what code i would use to check if the affiliateid was pending or approved to run that program because the value of pendingaffiliates and approvedaffiliates would have more than 1 value in them. Can you suggest a way of doing this or a better way of doing this please.
If you have any questions feel free to ask, any help would be great.
Mar 21, 2011, 12:40 #2
- Join Date
- Oct 2005
- 3 Post(s)
- 1 Thread(s)
Your method is not a good one. That's for sure. Why don't you just create a second table and join the two when needed?
Mar 21, 2011, 13:14 #3
cheesedude is right - you'll need 3 tables to accomplish this:
Programs ------------------------ id image name description url affPayout newPayout country status Affiliates ------------------------ id name (etc) AffiliatePrograms ------------------------ id affiliateId programId status (i.e. 1 for pending, 2 for approved)aaron-fisher.com - PHP articles and more