Here are a couple of good books:
"PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide"
by Larry Ullman
http://www.amazon.com/gp/product/0321186486/
"PHP and MySQL Web Development (3rd Edition)"
by Luke Welling, Laura Thomson
http://www.amazon.com/gp/product/0672326728/
I've looked through the latter, and I include the former just because I like the Peachpit series.
A compound key makes it so that the table can't have two identical rows. So you can't insert two rows both with userID = 27 and userFav = 43.
The key also implicitly forms an index on the fields, which will help speed up searches and joins.
Assuming you use InnoDB tables, you can also make each column individually reference a users table, which will prevent invalid ID's from being entered.
So the table would look like this:
CREATE TABLE favorites (
userID INTEGER NOT NULL REFERENCES users (userID),
userFav INTEGER NOT NULL REFERENCES users (userID),
PRIMARY KEY (userID, userFav)
) ENGINE=InnoDB;
Regards,
Bill K.