shortcode with $atts with strange results

The functions you have above don’t use the id att at all. This might be what you want, but I’m not 100% sure what you’re going for.

function show_homepage_banner_function($atts) {

    $atts = shortcode_atts( array('id' => NULL), $atts );

    $content="";
    global $wpdb;

    $upload_url="";
    $upload_dir = wp_upload_dir();
    $target_dir = $upload_dir['basedir'];
    $upload_url = $upload_dir['baseurl'].'/banners/';

    $query = "SELECT * FROM {$wpdb->prefix}banners WHERE banner_type = "1" AND  end_date >= CURDATE()";
    $query .= isset($atts['id']) ? ' AND id=%d' : ' ORDER BY RAND()';
    $query .= ' LIMIT 1';
    $ban= $wpdb->get_row($wpdb->prepare($query, $atts['id']));

    if(count($result)) {
         $content="<div class="rdp-banner-1"><a href="".$ban->banner_link.'"><img src="'.$upload_url.$ban->picture.'" ></a></div>';                
    }
    return $content;
}

Note, I set this up to pick a random banner if no id is specified. I also assumed that the id column in the database is literally “id”.