stewart715 Posted November 7, 2006 Share Posted November 7, 2006 Hi, Barand help me with getting this far and i truly appreciate it. I actually donated because of it haha. But I need to make a link out of my result:[code]<?php$sql = "SELECT u.name FROM buddylist b INNER JOIN users u ON b.buddy = u.uid WHERE b.received = 1 AND b.uid = 2" ;$res = mysql_query($sql) or die (mysql_error());while ($row = mysql_fetch_row($res)) { echo "<a href=\"$uid[0]\">$row[0]</a><br />";}?>[/code]I need to have an sql query (along with what I have above) that will simply SELECT buddy FROM buddylist WHERE uid = 2 AND received = 1.i need it to fetch the row just like it is above and outputting something like $uid so i can make a link of the persons username showing their username but having a link with their userid number thanks agian!!! so..[code]in html echo "<a href=\"$uid[0]\">$row[0]</a><br />"; would turn into<a href="2">name</a><br/>[/code] Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 7, 2006 Share Posted November 7, 2006 try"SELECT u.nameFROM users AS UINNER JOIN buddlylist AS BON b.buddy = u.uidWHERE b.received = 1AND b.uid = 2" ;BUT YOU will need some clause in there that relates an entry in the buddylist table to the users table. Quote Link to comment Share on other sites More sharing options...
stewart715 Posted November 8, 2006 Author Share Posted November 8, 2006 Thank you. how would I place that as $uid though or some variable? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 8, 2006 Share Posted November 8, 2006 no just add another AND b.x = u.y Quote Link to comment Share on other sites More sharing options...
stewart715 Posted November 8, 2006 Author Share Posted November 8, 2006 thanks. and i could add that as a link as [code]<a href="uid">name</a>[/code]? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 8, 2006 Share Posted November 8, 2006 <a href="script.php?uid=<?php echo $uid; ?>">name</a> may be more useful... Quote Link to comment Share on other sites More sharing options...
stewart715 Posted November 8, 2006 Author Share Posted November 8, 2006 i understand but i was giving an example..to explain..im trying to get a list of a users pending friend requests..so it matches buddy with uid and when receieved =1 that means its pending..so i need to produce a list of pending friends names..which i have above..but i also need to make a link that goes to their profile..but i need their UID from a query to do it..thanks for all your help though i really appreciate it Quote Link to comment 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.