2017-06-23 24 views
2

我已經按城市排序了下拉菜單。它的排序正確,但點擊提交按鈕後,它們的順序不是按字母順序的。 查詢:提交表格後不按字母順序排序

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

使用'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