Conditional arguments WP_Query for post custom fields

Here is a modification of your code where you can add the meta query if certain $GET keys are set.

$query_array = array('relation' => 'AND');

if(isset($_GET['gender']) && !empty($_GET['gender'])){
    $gender = $_GET['gender'];
    array_push($query_array, array('key' => 'wpcf-gender', 'value' => $gender, 'compare' => '='));
}
if(isset($_GET['city']) && !empty($_GET['city'])){
    $city = $_GET['city'];
    array_push($query_array, array('key' => 'wpcf-city', 'value' => $city, 'compare' => '='));
}

if(isset($_GET['state']) && !empty($_GET['state'])){
    $state = $_GET['state'];
    array_push($query_array, array('key' => 'wpcf-state', 'value' => $state, 'compare' => '='));
}

                $wp_query = new WP_Query( array( 
                    'post_type' => 'profile',
                    //'query' => $query_array, should be 'meta_query' => $query_array,
                    'meta_query' => $query_array,
                    'paged' => $paged ) 
                );

Reference:

array_push() : http://php.net/manual/en/function.array-push.php

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)