spoonraker Posted September 24, 2007 Share Posted September 24, 2007 Well I'm coding a website with MySQL functionality. The page I'm working on is a page where one person can look up information on another person that they sponsor. There is a checklist that each sponsor much complete for each affiliate, and the values of these checkboxes must be saved to the MySQL database for retrieval later.Keep in mind each sponsor can have multiple affiliates and each of them need their own checkbox data for the sponsor.For example here is some randomly made up dataSponsor ID Affiliate ID Checkbox----------------------------------------------------1 20 Y1 21 N1 34 Yproblem is I can not have the same sponsor ID for multiple rows, even with different data in all the other columns....how do you go about doing something like this? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 24, 2007 Share Posted September 24, 2007 You can have the same sponsor id if you want. The only reason you wouldn't be able to is if you made that column a primary key. It would be better to make both the sponsor id and the affiliate id a complex primary key. Link to comment Share on other sites More sharing options...
spoonraker Posted September 24, 2007 Author Share Posted September 24, 2007 I thought it should have worked but you're right I accidentally made the sponsor ID a primary key. Link to comment Share on other sites More sharing options...
spoonraker Posted September 24, 2007 Author Share Posted September 24, 2007 How do you remove a primary key from a column? alter table TABLE change COLUMN COLUMN int(20); didn't work, still primary key Link to comment Share on other sites More sharing options...
justsomeguy Posted September 24, 2007 Share Posted September 24, 2007 ALTER TABLE table DROP PRIMARY KEY Link to comment Share on other sites More sharing options...
spoonraker Posted September 25, 2007 Author Share Posted September 25, 2007 that worked, thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.