Wp query by 2 meta field – check if they exists / have value

Check the Codex. meta_query accepts an EXISTS comparison.

$args = array(
    'post_type' => 'somepostype',
    'meta_query' => array(
        array(
            'key' => 'fname'.$userid,
            'compare' => 'EXISTS',
        ),
        array(
            'key' => 'lname'.$userid,
            'compare' => 'EXISTS',
        )
    )
);
$query = new WP_Query( $args );
return $tempquery->found_posts;

There is a note that…

Note: Due to bug #23268, value is required for NOT EXISTS comparisons
to work correctly. You must supply some string for the value parameter
– Note: empty string or NULL do NOT work. However, any other string will do the trick and will NOT show up in your SQL when using NOT EXISTS.

It sounds as though EXISTS is not effected but I have not tested that. However, you may need to add a placeholder value if that still doesn’t work.

tech