Php 在Mysql命令中使用时字体颜色问题

Php 在Mysql命令中使用时字体颜色问题,php,mysql,html,Php,Mysql,Html,我使用的字体颜色是红色,但在我的页面中显示为绿色 <?php include('connect-db.php'); $result = mysql_query("SELECT * FROM players") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo '<font color=\"red\">'; echo $row

我使用的字体颜色是红色,但在我的页面中显示为绿色

<?php

include('connect-db.php');

$result = mysql_query("SELECT * FROM players") or die(mysql_error());

while($row = mysql_fetch_array( $result )) {     
    echo '<font color=\"red\">';              
    echo $row['firstname']  ;
    echo '</font>';
    echo ':';
    echo $row['lastname'] ;
    echo '<br><br>';
} 

?>



为什么不使用CSS来实现这一点?不要依赖这些HTML属性。它们已被弃用或即将弃用。始终使用CSS。您也不需要所有的
echo
s,每行一个。例如,您可以使用
herdoc
。如果您现在不需要单独的CSS类,那么将
标记中的
颜色
属性替换为类似于
样式
属性。
<?php

include('connect-db.php');

$result = mysql_query("SELECT * FROM players") or die(mysql_error());

while($row = mysql_fetch_array( $result )) {     
echo '<span style=\"color:red;\">';              
echo $row['firstname']  ;
echo '</span>';
echo ':';
echo $row['lastname'] ;
echo '<br><br>';
} 

?>