SELECT * FROM friends WHERE (user1 = $userid OR user2 = $userid) AND accepted = 1
how would a JOIN look like if i want to get lets say user2's information from table "users"?
table friends:
id
int(11) NOT NULL auto_increment,
user1
int(11) NOT NULL,
user2
int(11) NOT NULL,
date
datetime NOT NULL,
accept
tinyint(1) NOT NULL,
type
varchar(32) NOT NULL
users:
id
mediumint(8) NOT NULL auto_increment,
username
varchar(32) NOT NULL,
password
varchar(40) NOT NULL