我有一個包含錯誤代碼,日期和郵件地址的mysql數據庫表。添加jQuery日期選擇器到php列表
我下面的腳本顯示了一個基本的列表,每截圖,
我希望能夠通過日期篩選,我希望能使用jquery日期選取器。
這個想法是,只顯示日期匹配在jquery日期選擇器中的條目。
用於顯示列表的PHP代碼:
<?php
// Add Logo
$image = "logo.png";
$width = 300;
$height = 280;
echo '<img src="'.$image.'" style=width:"' . $width . 'px;height:' . $height . 'px;">';
// Make a MySQL Connection
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("pmta_reporting") or die(mysql_error());
// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM address")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>Error</th> <th>Date</th> <th>Mail Address</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['code'];
echo "</td><td>";
echo $row['date'];
echo "</td><td>";
echo $row['address'];
echo "</td></tr>";
}
echo "</table>";
// disconnect from the database
mysql_close();
?>
我使用的日期選擇器的代碼是
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$("#datepicker").datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
我怎樣才能jQuery的日期選取器添加到腳本,以便當用戶選擇日期時,頁面上顯示的結果只顯示用戶選擇的日期?
我注意到你使用類而不是一個id這種功能。 一個ID它只是使用一次,一個類可以使用多次 – KLK1 2013-04-24 06:45:00