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
相關問題