有没有可能创建一个日历,当我点击特定的月份、日期和年份时。我可以用所选日期的数据显示我的表?
这是我的代码,它只显示我的表"report“中的数据
$result = mysqli_query($con,"SELECT * FROM report");
echo "<head><style>
table {
border: 3px solid black;
width: 100%;
height: 100px;
text-align: center;
margin: 0px;
}
td, tr, th {
border: 1px solid black;
margin: 0px;
}
.page td {
padding:0; margin:0;
}
.page {
border-collapse: collapse;
}
.page a {
text-decoration: none;
}
</style></head>";
echo "<table class='page'>
<tr>
<th>Agency</th>
<th>FileName</th>
<th>FileType</th>
<th>Date Received</th>
<th>Action</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['agency'] . "</td>";
echo "<td>" . $row['filename'] . "</td>";
echo "<td>" . $row['filetype'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td><a target='_blank' href='../annual/CAAP/" . $row['filename'] .
"'>OPEN FILE</a></td>";
echo "</tr>";
}
echo "</table>";发布于 2019-03-08 17:08:31
您需要以某种方式在PHP中获取日期,因此可以通过表单提交或使用固定日期(今天?)在脚本中设置。然后使用where-子句限制查询中的结果,使其与PHP脚本中的日期相匹配。
事实上,您的问题是一个基本的PHP和MySQL问题,我假设您在这两个方面都没有太多经验。我建议仔细阅读这两篇文章,并从使用的示例中学习。这是学习更多关于MySQL where子句的好资源:http://www.mysqltutorial.org/mysql-where/
https://stackoverflow.com/questions/55058994
复制相似问题