gpt4 book ai didi

mysql - 当我按字母顺序排列结果时?

转载 作者:行者123 更新时间:2023-11-30 00:45:38 26 4
gpt4 key购买 nike

当我将结果按字母顺序排序时?

需要它读取目录并在mysql中按字母顺序添加文件...

$path = "artes110/$grupo";
$diretorio = opendir($path);

while ($arquivo = readdir($diretorio)){
if ($file != '.' && $file != '..')
{
$arquivo = utf8_encode($arquivo);
$arquivo = html_entity_decode($arquivo);
$query = mysql_query("INSERT INTO artes101 (imagem, data, texto, layout, grupo) VALUES ('$path/$arquivo', '$data2', '$texto', 'peq', '$grupo')") or die(mysql_error());

}
}

最佳答案

在 mysql 中,您可以按任意顺序添加它们,然后通过在 SQL 代码中添加 order by 子句来对它们进行排序。

SELECT * FROM artes101 ORDER BY imagem DESC;

您可以将 imagen 更改为您希望排序的任何字段,并且可以通过将 DESC 更改为 ASC 来更改顺序方向>

关于mysql - 当我按字母顺序排列结果时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21381992/

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