因此,我正在尝试使用框中的帖子构建一个博客风格的网站。我设法让这些名字从数据库中回显,但它们都是相互重叠的。我希望它能使数据库中的每个名称都有自己的框。有任何想法吗?这是我的代码:
<div class="box1">
<div class="productimage"><img src=""></div>
<?php
while($data = mysql_fetch_array($sql))
{
echo '<div class= "prodname">' . $data['name'] . '</div>';
}
?>
<div class= "proddesc1st"> Armageddon (Prod. Brandon Thomas)</div>
<div class="location"> London, UK - </div>
<div class="tags1st"> #Electronic, #Producer </div>
<div class="bioname">Lil B</div>
<div class="biopic">Rapper/Producer</div>
<div class="twitterhandlebox"> @lilbthebasegod</div>
<div class="followbutton"> Follow </div>
</div>
</div>
</div>
答案 0 :(得分:1)
你应该这样做。
<?php
while($data = mysql_fetch_array($sql)){
?>
<div class="box1">
<div class="productimage"><img src=""></div>
<div class= "prodname"><?php echo $data['name'] ?></div>
<div class= "proddesc1st"> Armageddon (Prod. Brandon Thomas)</div>
<div class="location"> London, UK - </div>
<div class="tags1st"> #Electronic, #Producer </div>
<div class="bioname">Lil B</div>
<div class="biopic">Rapper/Producer</div>
<div class="twitterhandlebox"> @lilbthebasegod</div>
<div class="followbutton"> Follow </div>
</div>
<?php } ?>