If search results empty then execute certain code

Your code will check whether you are on a search page or not ( You also forgot to wrap your conditional in parentheses ).

In order to check if there is any result for your search, use have_posts():

if( have_posts() ) {
    // There is a post
} else {
    // No results
}

This works for global queries. If you wrote your own instance of WP_Query(), you need to do as follows:

$my_query = new WP_Query($args);

if( $my_query->have_posts() ){
    // There is a post
} else {
    // No results
}

tech