提交表单后不按字母顺序排序

Posted

技术标签:

【中文标题】提交表单后不按字母顺序排序【英文标题】:Not sorting alphabetically after submit the form 【发布时间】:2017-06-23 11:20:56 【问题描述】:

我已经对城市的下拉菜单进行了排序。它的排序正确,但是在单击提交按钮后,它们的顺序不是按字母顺序排列的。 查询:

$cities = $wpdb->get_results( "select ID, post_title from $wpdb->posts where post_type = 'place' and post_parent = $state_id", ARRAY_A );

【问题讨论】:

在查询中使用ORDER BY子句,并在您的问题中添加更多代码,这将有助于我们更好地理解您的问题。 【参考方案1】:

使用下面的代码希望对你有帮助-

$cities = $wpdb->get_results( "select ID, post_title from $wpdb->posts where post_type = 'place' and post_parent = $state_id ORDER BY post_title ASC", ARRAY_A );

了解更多https://codex.wordpress.org/Class_Reference/wpdb

【讨论】:

以上是关于提交表单后不按字母顺序排序的主要内容,如果未能解决你的问题,请参考以下文章