gpt4 book ai didi

PHP 回显多个 div 类

转载 作者:行者123 更新时间:2023-11-29 12:27:50 25 4
gpt4 key购买 nike

所以我正在尝试建立一个博客风格的网站,其中的帖子放在框中。我已经设法让名称从数据库中回显,但它们都显示在彼此之上。我希望数据库中的每个名称都有自己的框。有任何想法吗?这是我的代码:

<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>

最佳答案

你应该做这样的事情。

<?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 } ?>

关于PHP 回显多个 div 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28034351/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com