Ah yes, you used friend_id in the first table.
So it should be:
$sql = "SELECT * FROM friends WHERE my_id=$myid AND friend_id NOT IN (SELECT their_id FROM address_book WHERE my_id=$myid)";
I'm a bit confused about this part (SELECT their_id FROM address_book) I mean, I understand the concept ... Is that just another query?
Yes, it's a sub-query.
Basically, it performs a second query inside the first one, to get a list of ids to match against the one in the first query.
It can be very handy at times. Well worth looking into.Yes, $myid is a #. I never knew I didn't have to quote numbers. Is is because they don't need to read as string?
Yea. Only strings and string-like data, such as dates, need to be quoted. Numbers don't.
Doesn't really matter that much today, MySQL 5 does a good job of spotting numbers even if they are quoted, but older software would give you incorrect results, or even errors, if you quoted numbers.(Not sure exactly if MySQL ever did that tho, but I definetly remember M$ SQL server doing it way back.)