mySql Relationships / Index - Checking for duplicates
I'm not sure if I understand correctly. As long as you have a unique key on both columns, it does not matter what order the columns (or combination) they are in. Otherwise, the tuple must also exist in the referencing table in order to enforce it's uniqueness. 

CREATE TABLE tbluser (
  user int,
  details int,
  primary key(user, details));

CREATE TABLE tblconnections (
  user int,
  details int,
  connection int,
  primary key(user, details, connection),
  unique key(user, details),
  foreign key (user, details) 
    references tbluser (user, details));


Make sure that you specify a column list when you make this INSERT.