我有一个网站,您可以在其中显示您的推特链接,人们可以关注您,我不希望这些帖子靠近在一起,因为您可以看到它们相距太远这就是网站http://twitterdistrict.comuf.com/index.php
评论代码是这个
<?php
require('connect.php');
$query=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($query))
{
$id=$rows['id'];
$dname=$rows['name'];
$dcomment=$rows['comment'];
echo '<div id="username_word"><font color="red">username:</font></div>' ."<a href='$dname' id = 'name' style='color: #77cde6' STYLE='TEXT-DECORATION: NONE'>$dname</a>"."<div id ='dash'><font color='red'> - </font> </div>"."<div id='comment'>$dcomment</div>"
."<div id='followbtn'><a href='$dname'><img src='http://i45.tinypic.com/2yltzkg.png' width ='30px' height ='30px' border='0' alt='follow'></div></a>" ;
}
?>
答案 0 :(得分:0)
我建议代码:
<?php
require('connect.php');
$query=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($query))
{
$id=$rows['id'];
$dname=$rows['name'];
$dcomment=$rows['comment'];
?>
<div id="username_word"><font color="red">username:</font></div><a href="<?php echo $dname; ?>" id="name" style="color: #77cde6" STYLE="TEXT-DECORATION: NONE"><?php echo $dname; ?></a><div id="dash"><font color="red"> - </font> </div><div id="comment"><?php echo $dcomment; ?></div><div id="followbtn"><a href="<?php echo $dname; ?>"><img src="http://i45.tinypic.com/2yltzkg.png" width ="30px" height ="30px" border="0" alt="follow"></div></a>
<?php
}
?>
我用简单的HTML取代了echo。通过在HTML代码中使用echo
将值插入到HTML中。