MyBB Community Forums

Full Version: Querying "fid"s for executing a task in MyBB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The following task overwhelms my PHP knowledge (not a professional). That's why I'm asking for help here.

In the MyBB forum, when registering, users must:
Provide a 5-digit invoice number.
> The information is stored in the mybb_userfields table in the fid8 column.
In a task (mentally ... the examples below do not work) should be processed as follows:
A) with IF conditions?

(FID8)
if (fid8 >= 1 && fid8 <= 49999) {
$query = $db->query("UPDATE mybb_users SET additionalgroups = '8,9'");
}
etc.

B) with WHERE conditions?

FID8
$query = $db->query("UPDATE mybb_users SET additionalgroups = '8,9' WHERE fid8 >= '1' && fid8 <= '49000'");
etc.

How must the query of the "fid"s columns be carried out (defined) so that, for example, different actions can be carried out with the content values of the columns "fid8" and "fid10" (see examples above) can perform?

Many thanks in advance for tips and hints.

Solution (example):

$db->query("UPDATE mybb_users u LEFT JOIN mybb_userfields f ON f.ufid = u.uid SET usergroup = '4' WHERE f.fid8 = 'xxx'");

Thanks to ExiTuS on MyBB.de

(Translate with Google Translater)