如果在玩家列表中找到了他们的汽车ID,我试图显示用户的帮派名称。
我可以获取其他细节,但这是我第一次尝试从数组中提取。
<div class="col-lg-3 col-md-6">
<div class="panel panel-yellow">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-users fa-2x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sid = $steamprofile['steamid'];
$bob = ("[`$sid`]");
$sql = "SELECT `name` FROM `gangs` WHERE `members` = (' . explode(',', $bob) . ')";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_array($result)) {
echo "<div class='big'>" . $row["name"] . "</div>";
};
?>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">Gang Management</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
答案 0 :(得分:1)
您的成员列似乎是 JSON数组文本字段。除非使用TEXT搜索方法,否则无法直接在其中进行搜索。
$query = 'select * from users where members LIKE "%\"' . $steamId . '\"%"';