gpt4 book ai didi

PHP MySQL 日历仅显示该日期的数据

转载 作者:行者123 更新时间:2023-11-29 09:49:30 26 4
gpt4 key购买 nike

是否可以创建一个日历,当我单击特定的月份、日期和年份时。我可以显示我的表格以及所选日期的数据吗?

这是我的代码,仅显示我的表“报告”中的数据

$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>";

最佳答案

您需要以某种方式在 PHP 中获取日期,因此可以通过表单提交或在脚本中设置固定日期(今天?)。然后使用该日期来限制查询中的结果,以匹配使用 where 子句的 PHP 脚本中的日期。

事实上,您的问题是一个基本的 PHP 和 MySQL 问题,我认为您对它们都没有太多经验。我建议阅读它们并从所使用的示例中学习。这是了解有关 MySQL where 子句的更多信息的好资源: http://www.mysqltutorial.org/mysql-where/

关于PHP MySQL 日历仅显示该日期的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55058994/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com