如何添加图像之间的空间通过php使用数据库获取


How to add space between the images being fetched using database through php

我使用以下代码获取图像使用数据库与php。

while($row = mysql_fetch_array($result))  //To excute result query 
{
echo "<a href='http://".$row['website']."' target='_blank'><img src='"" . $PathImage .       $row['logo'] . "'" height = $FooterWidth /></a>XX;
}

在这里,我使用$row[logo]是获取存储在服务器和XX的图像的路径,把具有相同颜色的文本XX作为背景的图像之间的间隔,但我想使用适当的方法,我知道这可以使用表,但我想做到这一点,而不使用表。

有什么建议吗?

你可以这样使用:

echo <a href='http://".$row['website']."' target='_blank' style='margin:10px'>

你的代码坏了,你忘记关闭引号了!这样就可以了:

while($row = mysql_fetch_array($result))  //To excute result query 
{
echo "<a href='http://".$row['website']."' target='_blank'><img src='"" . $PathImage . $row['logo'] . "'" height = $FooterWidth /></a> ";
}

但我会使用CSS解决方案,并为图像添加空白:

while($row = mysql_fetch_array($result))  //To excute result query 
{
echo "<a style='"margin-right:10px;'" href='http://".$row['website']."' target='_blank'><img src='"" . $PathImage . $row['logo'] . "'" height = $FooterWidth /></a>";
}

write like

echo $row[logo]." ";

echo "<a href='http://".$row['website']."' target='_blank'><img src='"" . $PathImage .       $row['logo'] . "'" height = $FooterWidth /></a>&nbsp;&nbsp;";

空格

 echo "<a style='margin-right:10px;' href='http://".$row['website']."' target='_blank'><img src='"" . $PathImage .       $row['logo'] . "'" height = $FooterWidth /></a>";
echo "<a href='http://".$row['website']."' target='_blank' style='margin:10px'><img src='"" . $PathImage .       $row['logo'] . "'" height = $FooterWidth /></a>XX;

你可以简单地把

echo "<img src='" . $row[logo] . "' style='margin: 10px;'>";
使用CSS

。我强烈建议阅读CSS,因为它是所有web开发的基础!你可以从http://www.w3schools.com/css/开始。

祝你好运!