我是PHP新手,嘗試學習足夠的基本功能。我已經能夠爲我的用戶創建一個表格來編輯自己,並重新顯示,但我遇到了一個問題。 使用下面的腳本,用戶可以輸入他們的各種產品的技能水平。我希望能夠突出顯示它們輸入「0」或空白的每個單元格。用戶的輸入將在0-5之間(如果還沒有填入,則輸入空白)。根據MySQL查詢輸出設置單元格的背景顏色
這一切都在我的本地主機上完成,所以我承認所有的安全措施都不在那裏。
我已經閱讀了很多文章,並試圖找出自己,但我正在做一些根本性錯誤,我相信。
任何這方面的援助將不勝感激。我已經知道買啤酒(通過PayPal)對於那些誰幫我編碼:)
這裏是我現有的用於打印出數據庫的結果代碼:
<?php
//This will connect to the database in order to begin this page
mysql_connect("localhost", "root", "time2start") or die (mysql_error());
//Now we will select the database we need to talk to
mysql_select_db("joomla_dev_15") or die (mysql_error());
$query = "SELECT * FROM enterprise_storage WHERE id=1";
$result = mysql_query($query) or die (mysql_error());
echo "<table border='1'>";
echo "$row";
echo "<tr> <th>Product</th> <th>Wayne Beeg</th> <th>Paul Hamke</th> <th>Steve Jaczyk</th> <th>David Jontow</th> <th>Ed MacDonald</th> <th>Michael Munozcano</th> <th>Ron Shaffer</th> <th>Luke Soares</th> <th>Josh Wenger</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array($result)) {
// Print out the contents of each row into a table
echo "<tr><td>";
echo $row['model'];
echo "</td><td>";
echo $row['beeg'];
echo "</td><td>";
echo $row['hamke'];
echo "</td><td>";
echo $row['jaczyk'];
echo "</td><td>";
echo $row['jontow'];
echo "</td><td>";
echo $row['macdonald'];
echo "</td><td>";
echo $row['munozcano'];
echo "</td><td>";
echo $row['shaffer'];
echo "</td><td>";
echo $row['soares'];
echo "</td><td>";
echo $row['wenger'];
echo "</td></tr>";
}
echo "</table>";
?>
<FORM>
<INPUT TYPE="BUTTON" VALUE="Return to the Home Page" ONCLICK="window.location.href='http://localhost/~user/joomla15/custom/skilldisplay.php'">
</FORM>
這一個也不能工作。我粘貼就像你在這裏指出的那樣。保存後頁面不會加載。 (我也改變了「灰色」到「紅色」) – user1267673 2012-04-10 22:17:32
最新錯誤? – Dion 2012-04-10 22:31:21
應該是「背景色」嗎? 'color'控制文本的顏色,而不是單元格。 – octern 2012-04-11 02:02:47