我需要一个帮助。我需要从数据库中获取数据并使用PHP和MySQL根据列值对它们进行排序。我正在解释下面的场景。
db_users :(表名)
id user_name user_type
1 usr1 1
2 user2 1
3 user3 2
4 user4 2
5 user5 3
6 user6 3
7 user7 4
8 user8 4
上面给出了我的表名。
这里我首先需要获取所有数据,我应该以数组格式获取数据,如下所示。
$values=array('member'=>$member_type,'no_of_member'=>2)
print json_encode($values);
此处条件是user_type==1
$member_type
member1
no_of_member
和for user_type 2 it should member2 and so on...
将是多少个member1(在这种情况下是2)。就像这样所有数据都应相应设置(let searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad() {
/* Search controller parameters */
searchController.searchResultsUpdater = self // This protocol allows your class to be informed as text changes within the UISearchBar.
searchController.dimsBackgroundDuringPresentation = false // In this instance,using current view to show the results, so do not want to dim current view.
definesPresentationContext = true // ensure that the search bar does not remain on the screen if the user navigates to another view controller while the UISearchController is active.
let tableHeaderView: UIView = UIView.init(frame: searchController.searchBar.frame)
tableHeaderView.addSubview(searchController.searchBar)
self.tableView.tableHeaderView = tableHeaderView
}
override func scrollViewDidScroll(scrollView: UIScrollView) {
let searchBar:UISearchBar = searchController.searchBar
var searchBarFrame:CGRect = searchBar.frame
if searchController.active {
searchBarFrame.origin.y = 10
}
else {
searchBarFrame.origin.y = max(0, scrollView.contentOffset.y + scrollView.contentInset.top)
}
searchController.searchBar.frame = searchBarFrame
}
)。请帮助我。