-1

我有一个网站,您可以在其中显示您的 twitter 链接,人们可以关注您,我不希望这些帖子靠得更近,因为您可以看到它们相距太远,这是该网站http://twitterdistrict.comuf.com/索引.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>" ;    

     }
?>
4

1 回答 1

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。echo通过在 HTML 代码中使用将值插入到 HTML 中。

于 2012-08-10T09:47:34.313 回答