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]
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.