我编写了下面的代码,我可以在一个单独的div中加载一个列的每个图像,有人可以帮我调整代码,以便它打开同一个div中的所有图像吗?
<?php
mysql_connect("localhost","root","");
mysql_select_db("bravo");
$res=mysql_query("select * from coisas");
while ($row=mysql_fetch_array($res)) {
echo "<div>";?> <img src="<?php echo $row["imagem"]; ?>"> <?php echo "</div>";
}
?>
答案 0 :(得分:1)
试试这个
<?php
mysql_connect("localhost","root","");
mysql_select_db("bravo");
$res=mysql_query("select * from coisas");
echo "<div>";
while ($row=mysql_fetch_array($res)) {
echo "<img src=".$row["imagem"].">";
}
echo "</div>";
?>
答案 1 :(得分:0)
<?php
mysql_connect("localhost","root","");
mysql_select_db("bravo");
$res=mysql_query("select * from coisas");
echo "<div>";
while ($row=mysql_fetch_array($res)) { ?>
<img src="<?php echo $row["imagem"]; ?>">
<?php
}
echo "</div>";
?>
答案 2 :(得分:0)
<?php
mysql_connect("localhost","root","");
mysql_select_db("bravo");
$res=mysql_query("select * from coisas");
?>
<div>
<?php
while ($row=mysql_fetch_array($res)) {
echo "<img src=\"{$row['imagem']}\">";
}
?>
</div>
答案 3 :(得分:0)
echo "<div>";
while ($row=mysql_fetch_array($res)) {
?> <img src="<?php echo $row["imagem"]; ?>">
<?php
}
echo "</div>"; ?>
答案 4 :(得分:0)
<?php
mysql_connect("localhost","root","");
mysql_select_db("bravo");
$res = mysql_query("select * from coisas");
while ($row=mysql_fetch_array($res)):
?>
<div><img src="<?php echo $row["imagem"]; ?>"></div>;
<?php endwhile; ?>