この mysql クエリから必要な結果を取得するのに問題があります。そして、問題は次のコード行にあると思います。
$group="SELECT * from mybb_users where usergroup AND additionalgroups = '$usergroup'";
データベースの additionalgroups 列にはコンマ (,) で区切られた複数の値があるのに対し、usergroup には 1 つの値しかないことに気付いたからです。スクリーンショットは次のとおりです。
ここに画像があります:http://i.imgur.com/UTbmX.jpg
コードから additionalgroups 列を削除し、usergroup 列のみをチェックすると、コード全体が完全に機能しますが、それは私が望むものではありません:(以下はコード全体です:
// Connect to server and select databse.
mysql_connect("$db_host", "$db_user", "$db_pass")or die("cannot connect to mysql");
mysql_select_db("$db_name")or die("cannot select DB");
$id=$_GET['lid']; // Get lid from URL
$usergroup =$_GET['game']; // Get the usergroup/game from the URL
// Check to see if the user is a VIP Member and fetch them.
$group="SELECT * from mybb_users where usergroup AND additionalgroups = '$usergroup'";
$group2=mysql_query($group) or die("Could not get users");
while($raw=mysql_fetch_array($group2))
{
// Fetch all UserIDs of the VIP members and match them with the UfID (in the userfields table)
$userid = $raw['uid'];
$group3="SELECT * from mybb_userfields where ufid = '$userid'";
$group4=mysql_query($group3) or die("Could not match userid");
while($raw=mysql_fetch_array($group4))
{
// assigns a lid from the vip members to the variable $lid
$lid = $raw['fid7'];
// Display the hash of the lid if it matches with the lid from the URL
if($lid == '')
{
}
elseif($lid == $id)
{
echo "[key]{$lid};";
}
else
{
}
}
}