gpt4 book ai didi

php - 按日期排序

转载 作者:行者123 更新时间:2023-11-29 05:32:15 24 4
gpt4 key购买 nike

我正在使用 PHP 开发一个搜索工具,它从数据库中检索数据。它有效,但现在我想按最新日期对结果进行排序。 created 是存储数据库时间戳的列的名称。

这是我的代码:

$res = mysql_query("SELECT * FROM book WHERE MATCH
(title,cat_number,isbn,issn,created,subject) AGAINST ('$q' $mode) LIMIT 50", $db);

$list = array();
while($row = mysql_fetch_assoc($res))
{
$list[] = $row;
}
mysql_free_result($res);

最佳答案

ORDER BY created DESC 添加到您的 SQL 语句中。

关于php - 按日期排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13775639/

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