get_results( "SELECT * from $wpdb->prefix" . "apt_category" ); ?> Select Service prefix . "apt_services"; $appointment_details = $wpdb->get_results( "SELECT * from $service_table where category= '$appointment_category_single_detail->id'" ); foreach ( $appointment_details as $appointment_client_single_detail ) { ?> first_name; ?>last_name; ?>