MyBB Hacks

Full Version: Printing Out Accounts w/ x Profile Field
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
UPDATED 10/22/2018: New information with where I've gotten thanks to the help of a friend suggesting to use SELECT DISTINCT to print out exact inputs from a field.

What I am attempting to do is create a script that prints out accounts with the input of x profile field. This profile field varies with input and can be edited quite often. So each profile field input is then printed out into its own section like so:

PHP Code:
$Candy = $db->query("
    SELECT DISTINCT fid15
    FROM ".TABLE_PREFIX."userfields
    WHERE fid15 != ''
    ORDER BY fid15 ASC
");
while($result=$db->fetch_array($Candy)) {
    $type = $result['fid15'];
	eval("\$CandyList .= \"".$templates->get("candy_entry")."\";");
}


From here I am attempting to then also spit out the accounts in the while/result of $Candy ($CandyList template variable/candy_entry specific field template).

PHP Code:
$Candy = $db->query("
    SELECT DISTINCT fid15
    FROM ".TABLE_PREFIX."userfields
    WHERE fid15 != ''
    ORDER BY fid15 ASC
");
while($result=$db->fetch_array($Candy)) {
    $type = $result['fid15'];
	eval("\$CandyList .= \"".$templates->get("candy_entry")."\";");
	
	$CandyU = $db->query("
        ?????????
    ");
	while($result=$db->fetch_array($CandyU)) {
        $userid = $result['uid'];
        $username = format_name($result['username'], $result['usergroup'], $result['displaygroup']);
        eval("\$CandyUsers .= \"".$templates->get("candy_users")."\";");   
    }
}


However everything I've tried to add in the $CandyU area just does not want to spit out the users with that particular field and quite frankly I'm lost. Help is very much appreciated!

Friendly bump + updated to be a bit more 'descriptive' to my best abilities.
Additional friendly bump, updated with new information again and to the extent I have gotten but am now stuck at.
Reference URL's