jacko310592 Posted May 4, 2010 Share Posted May 4, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/200665-cross-join-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 4, 2010 Share Posted May 4, 2010 USING(userId) That would cause the query to check if you are online, not if your friend is online. Should work - ON ud.userId = uf.friend_userId Quote Link to comment https://forums.phpfreaks.com/topic/200665-cross-join-problem/#findComment-1052999 Share on other sites More sharing options...
jacko310592 Posted May 4, 2010 Author Share Posted May 4, 2010 thanks mann, works great now (: Quote Link to comment https://forums.phpfreaks.com/topic/200665-cross-join-problem/#findComment-1053003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.