Jump to content

Multiple SQL Queries (Barand if you're still here)


stewart715

Recommended Posts

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]
try

"SELECT u.name
FROM users AS U
INNER JOIN buddlylist AS B
ON b.buddy = u.uid
WHERE b.received = 1
AND b.uid = 2" ;

BUT YOU will need some clause in there that relates an entry in the buddylist table to the users table.
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

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.