Jump to content

Cross Join problem


jacko310592

Recommended Posts

hey everyone,

i have the following query, which i need it to...

[*]retrieve a user's friend ID's from a friends table

[*]compare it with a secondary table to see if the friend is online

 

the query:

$userInfoArr = mysql_query("SELECT SQL_CALC_FOUND_ROWS friend_userId FROM user_friends_{$tableSuffix} AS uf
	CROSS JOIN user_details AS ud
	USING(userId)
	WHERE uf.userId='$loggedInUserId'
	&& ud.markedOnline=TRUE")or die(mysql_error());

($loggedInUserId is the userId of the person logged in)

currently, it doesnt seem to be getting info from the user_details table.

this is how my two tables are set out...

 

user_details:

 

userId  |  markedOnline

--------------------------------

bob01  |  1

--------------------------------

fred      |  0

 

 

user_friends:

 

userId  |  friend_userId

------------------------------

bob01  |  fred

------------------------------

fred      |  bob01

 

 

can anyone please suggest where im going wrong?

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/200665-cross-join-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.