Jump to content

getting info from 2 tables


izbryte

Recommended Posts

table one has a field titled friends which holds the member's id and a list of the member's friend's id #'s in csv format (i.e. 1,4,5,7,8).

table two has info about all members (such as id, nickname, photo, etc).

 

I'm trying to access the friend list of a particular member (table 1) and then access those friend's info.

Here's what I have but I'm getting an error:

 $friend_list = mysql_query("SELECT `friends_id` FROM `friends` WHERE `user_id`=".$_SESSION['userid']." LIMIT 1");
					 $friend_list = mysql_query("SELECT `user_id`,`hs`,`photo`,`photo_status`,`username` FROM `users` WHERE `user_id` IN (".substr($friend_list,0,-1).")") or die(mysql_error());

 

(friends_id will be the user_id of a member)

Please tell me if I'm not making sense....

Link to comment
https://forums.phpfreaks.com/topic/222024-getting-info-from-2-tables/
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.