The website is for sale. Check here for more information.
This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.
Printing Out Accounts w/ x Profile Field

I am attempting to create a script that prints out accounts with the input of x profile field. HOWEVER this profile field can vary and is edited by members to input anything they please. 

So for example the profile field is: 

Favorite Candy? Users can input anything from Snickers, Twix, Red Hot to even Zero Bars...

My main problem here is I know how to print out users IF I know what the profile field = (WHERE fid5 = 'Twix' for example). However this is a ranging answer so I cannot do a query for each possible candy out there. So what I'm trying to do instead is use a query that puts fid5 in its own sections each time.

User1, User2, User3 and so on.
User1, User2, User3 and so on.

Any help would be appreciated.


MANAGED TO GET THIS GOING, not sure how proper it is or if it would even do what I'm wanting buuuut:
PHP Code:
$Candy $db->query("
    ON "
.TABLE_PREFIX."userfields.ufid = ".TABLE_PREFIX."users.uid
    WHERE fid15  AND "
.TABLE_PREFIX."users.usergroup IN (19,18,11,9,10,3)
    ORDER BY fid15 ASC

However, the while part is where I'm thinking things are wrong. Because there would technically need to be a for each of the above script because it would print out category x, x, x in different sections. And THEN in those sections is where the while part would come in, which I do have:
PHP Code:
while($result=$db->fetch_array($Candy)) {
$userid $result['uid'];
$username format_name($result['username'], $result['usergroup'], $result['displaygroup']);
"\$CandyList .= \"".$templates->get("candy_entry")."\";");   


You could use the value as the key to an array and store it like this: (not valid PHP)
PHP Code:
$array[field_value][] = array(usernamegroupdisplaygroup); 

Then iterate the array with a foreach, for each table and then an inner foreach, for each user.
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.

  • View a Printable Version

Users browsing this thread: 1 Guest(s)

About MyBB-Plugins

Plug Yourself into the best MyBB AddOn.

Copyright © 2009-2021 MyBB-Plugins Forums.


  • 51,000+ Posts
  • 19,000+ Members
  • 3,600+ Threads

Impressed? For sure
Check Full Stats here