$stmt = $pdo->prepare('SELECT * FROM `15players` WHERE `ClubId`=' . $_GET['ClubId'] . ' ORDER BY `Rating` DESC LIMIT 0, 45 ');
$stmt->execute();
foreach ($stmt as $row) {
$playeravatar = $row['baseId'];
echo "<img class='face16' src=http://packarmy.nl/packs/playeravatars/".$playeravatar."-large.png>";
}
我使用此代码从我的数据库中获取结果,但我希望所有结果都显示在单独的div中。他们现在显示如下:
<div id='player'>
ALL RESULTS
</div>
但我希望他们能够像这样出现:
<div id='player'>
result 1
</div>
<div id='player'>
result 2
</div>
有没有人可以帮助我?
答案 0 :(得分:0)
您的代码对我来说不太清楚。这就是我理解你的问题,你可以这样做..
$stmt = $pdo->prepare('SELECT * FROM `15players` WHERE `ClubId`=' . $_GET['ClubId'] . ' ORDER BY `Rating` DESC LIMIT 0, 45 ');
$stmt->execute();
foreach ($stmt as $row) {
$playeravatar = $row['baseId'];
echo "<div class='clsno".$row."'>Your result Result(<img class='whatever _u_want' src='ur_image_link'>)</div>";
}