Printing Out Accounts w/ x Profile Field
Niki Offline
Junior Member
**
Posts: 26
Joined: Oct 2016
Post: #1
Printing Out Accounts w/ x Profile Field
Hello,

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.

Example:
Twix
User1, User2, User3 and so on.
Snickers
User1, User2, User3 and so on.

Any help would be appreciated.

Thanks!



MANAGED TO GET THIS GOING, not sure how proper it is or if it would even do what I'm wanting buuuut:

PHP Code:
1
2
3
4
5
6
7
$Candy = $db->query("
    SELECT * FROM ".TABLE_PREFIX."userfields
    LEFT JOIN ".TABLE_PREFIX."users
    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']);
	eval("\$CandyList .= \"".$templates->get("candy_entry")."\";");   
}

(This post was last modified: 09-21-2018 09:28 AM by Niki.)
01-18-2018 05:37 AM
Find all posts by this user Quote this message in a reply
Niki Offline
Junior Member
**
Posts: 26
Joined: Oct 2016
Post: #2
RE: Printing Out Accounts w/ x Profile Field
Friendly bump + updated to be a bit more 'descriptive' to my best abilities.
09-21-2018 08:06 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: