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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.