2011-04-28, 06:11 PM
I have a table that has a field called friendlist. Early on in the code I run this query:
A little further down in the code I do this:
It seems to be executing the code even though friendlist is null because I haven't added any values into it. All the other information it is grabbing from the first query is correct. What I am not doing correct with the second part?
$query = $db->query("SELECT u.*, f.*, ug.* FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."fb f ON (u.uid=f.uid)
LEFT JOIN ".TABLE_PREFIX."usergroups ug ON (u.usergroup=ug.gid)
WHERE u.uid='{$mybb->input['uid']}' AND f.uid='{$mybb->input['uid']}'");
$profile = $db->fetch_array($query);
A little further down in the code I do this:
if ($profile['friendlist']!=null)
{
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid IN(".$profile['friendlist'].")");
while ($friend = $db->fetch_array($query))
{
echo "<tr><td><a href='/forums/member.php?action=profile&uid={$friend['uid']}' style='color:{$friend['namecolor']}>{$friend['username']}</a></td><td><img src='{$friend['avatar']}' alt='' height='50' width='50' /></td></tr>";
}
}
It seems to be executing the code even though friendlist is null because I haven't added any values into it. All the other information it is grabbing from the first query is correct. What I am not doing correct with the second part?
error message Wrote:MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
Query:
SELECT * FROM mybb_users WHERE uid IN( )