get_results( “SELECT id,category_name FROM members_categories “);
$categoriesArray = array();
foreach($result as $row) {
$categoriesArray[$row->id] = $row->category_name;
}
if(isset($_POST[‘members_category’])) {
$query = “SELECT id,members_category, company_name, phone from members_details where members_category = “.$_POST[‘members_category’].” order by company_name”;
}
else {
$query = “SELECT id,members_category, company_name, phone from members_details order by company_name”;
}
$result = $wpdb->get_results($query);
$membersArray = array();
foreach($result as $row) {
if(isset($membersArray[$categoriesArray[$row->members_category]])) {
$tempDataArray = $membersArray[$categoriesArray[$row->members_category]];
}
else {
$tempDataArray = array();
}
$tempDataArray[] = $row;
$membersArray[$categoriesArray[$row->members_category]] = $tempDataArray;
}
?>

View Members

0) {
foreach($membersArray as $category => $members) {
?>



Unfortunately, there are no members to display.