MyBB Community Forums

Full Version: 1.8 uid list, get usernames and echo/print
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello! In my database I have a table that'd I like to access called mybb_statinfo within it I have a column called likes. The column stores UIDs like this: 345,497,2645. Each number of course is a UID.

I'm wondering if there's a way to grab those UIDs and print it out in a location. What would be the best way to achieve this?

Sorry! I'm terrible at this. But, it's a feature we wish to add to our forum in the future.

So basically the output would eventually end up being:
<a href="http://rpg-directory.com/user-345.html">John</a>, <a href="http://rpg-directory.com/user-497.html">Ronald</a>, & <a href="http://rpg-directory.com/user-2645.html">Suzy</a> like this.
$q = $db->write_query('SELECT DISTINCT u.uid, u.username
     FROM '.TABLE_PREFIX.'statinfo s
     LEFT JOIN '.TABLE_PREFIX.' u ON FIND_IN_SET(u.uid, s.likes) > 0
');

$comma = '';
while($u = $db->fetch_array($q))
{
    $profiles .= build_profile_link($u['username'], $u['uid']).$comma;
    $comma = $lang->comma;
}

//echo $profiles;

Something like this should work. Note that the statinfo table seems to be not well-designed and should most likely be normalized.
Thank you! I'll toy around with this a bit! Thank you very much.

It is a Yaldaram table. It feels like it was going to be expanded; but the project looks abandoned and it's one of my favorite features for our site. We even paid for it. XD. Hopefully in the future Yaldaram's life gets less hectic. He has unique ideas.

It's stored in the table and they're numbered by sid. So, I'm trying to patch together a function to display the numbers when a certain sid is called.

Thanks again Destroyer666. <3