我希望能够在浏览器中按到期日期的顺序显示文档名称和到期日期。 Mysql表名是employee_doc,数据库名是employee_info。这是我的代码:
<link rel="stylesheet" href="css.css">
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'employee_info';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if(! $conn )
{
die('Could not connect: ' . mysqli_connect_error());
}
$sql = 'SELECT * FROM `employee_doc` ORDER BY `COL 2` ASC';
$retval = mysqli_query($conn,$sql);
if(! $retval )
{
die('Could not get data: ' . mysqli_error($conn));
}
while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
{
echo $row['COL 1'];
echo "     ";
echo $row['COL 2'];
echo "<br><br>";
}
mysqli_close($conn);
?>
COL 1有护照号码,COL2有到期日。问题是文档仅基于当天的第一个数字显示。它也是从&#39; 10开始的。然后回到&#39; 11&#39;。它没有考虑到从1,2,3 ....然后10开始的日子。它也没有考虑月份和年份。这是订购和打印文件的方式:10/5/2025 - 10/8/2018 - 11/2/2020 - 12/10/2016 - 12/2/2021 - 14/06/2021 - 02/4 / 2017年 - 20/02/2023 - 21/02/2025 - 22/07/2019 - 29/10/2024 - 30/03/2019 - 31/05/2021 - 05/1/2023 - 06/11/2017 - 07/3/2020 - 07/4/2018 - 08/11/2025 - 09/7/2023等。请帮我纠正代码。感谢...