1
我是新的web dev,php,css和html。我想在我的表中放置一个css来显示数据库中的数据。但它不起作用。表html/css输出错误:意外T_STRING
这里是我的代码:
我的CSS文件被命名为“table.css” ......
<html>
<head>
<title>WEW</title>
<head>
<link href="table.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$con = mysql_connect("localhost","abc123","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database_ME", $con);
$result = mysql_query("SELECT * FROM id");
$data->set_css_class("table");
echo "<table class="table">
<tr>
<th>id</th>
<th>password</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr onmouseover="this.style.backgroundColor='#ffff66';" onmouseout="this.style.backgroundColor='#d4e3e5';">";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
mysql_close($con);
?>
</body>
</html>
发布你的CSS问题也没有完成 – 2011-05-19 09:12:24
阅读关于字符串和引号手动http://php.net/manual/en/language.types.string.php。 – mario 2011-05-19 09:12:47
你需要转义引号回显“
回答
我假设CSS文件写得很好,而且它使用的
.table
选择。那里面有一些语法错误,都是因为你需要躲避内
"
像这样:来源
2011-05-19 09:11:28
变化
和
变化到
来源
2011-05-19 09:13:20 bungdito
它的工作完美,TNX的帮助! 我希望行也改变,当我点击它,然后它保持那种颜色这是我的css文件: table.hovertable {font-family:verdana,arial,sans-serif; font-size:11px; color:#333333; border-width: 1px; border-color:#999999; border-collapse:collapse;} table.hovertable th {background-color:#F0E68C; border-width:1px; padding:8px; border-style:solid; border-color:# a9c6c9;} table.hovertable tr {background-color:#d4e3e5;} table.hovertable td {border-width:1px; padding:8px; border-style:solid; border-color:#a9c6c9;} – jack 2011-05-20 04:12:46
@jack , 你不能问的问题在评论中,因为如果有人搜索相同的案例,它将不会显示。 您可以在这里接受或点赞一些答案 然后点击本页右上方的“提问”按钮,提出一个新问题,这样您就可以从别人那里得到很多答案,其他人也可以从您的问题中学习。 – bungdito 2011-05-20 17:22:40
相关问题