I'm trying to order people's friends list by points but my PHP/MySQL is pretty shoddy. Here's what I have...
foreach ($friends['data'] as $friend) {
$friendid = $friend['id'];
$friendget = mysql_query("SELECT * FROM users WHERE id='$friendid'");
$friendlist = mysql_fetch_array($friendget);
$friendlistid = $friendlist['id'];
$friendinfoget = mysql_query("SELECT * FROM users WHERE id='$friendid'");
$friendinfo = mysql_fetch_array($friendinfoget);
echo $friendinfo['name'];
}
But as you can see, all that is doing is echoing out the name's of my friends list. What I want it to do is echo out both names and points so I can order by points, but also keep the names with the points... if I try to echo out both and order by points of course only points are ordered while the names stay where they are.
Does anyone know how I should go about doing this? Thank you.
foreach ($friends['data'] as $friend) {
$friendid = $friend['id'];
$friendget = mysql_query("SELECT * FROM users WHERE id='$friendid'");
$friendlist = mysql_fetch_array($friendget);
$friendlistid = $friendlist['id'];
$friendinfoget = mysql_query("SELECT * FROM users WHERE id='$friendid'");
$friendinfo = mysql_fetch_array($friendinfoget);
echo $friendinfo['name'];
}
But as you can see, all that is doing is echoing out the name's of my friends list. What I want it to do is echo out both names and points so I can order by points, but also keep the names with the points... if I try to echo out both and order by points of course only points are ordered while the names stay where they are.
Does anyone know how I should go about doing this? Thank you.