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] Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/ 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. Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/#findComment-121289 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? Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/#findComment-121292 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 Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/#findComment-121294 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]? Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/#findComment-121297 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... Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/#findComment-121300 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 Link to comment https://forums.phpfreaks.com/topic/26512-multiple-sql-queries-barand-if-youre-still-here/#findComment-121308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.