We’re rewarding the question askers & reputations are being recalculated! Read more.
2 of 2 Code formatting.

How to show random feed from DB and show content in my site

I try to get more than 3 feed from other web site and show it in my site like :

function fw_shortcode( $atts ) {

    global $wpdb, $feedtable;
    $result=mysql_query("SELECT * FROM " . $feedtable . " ORDER BY RAND() LIMIT 3");

    while( $row=mysql_fetch_array($result) ) {  
        $rss = fetch_feed($row["weburl"]);
        if (!is_wp_error( $rss ) ) : 

            $maxitems = $rss->get_item_quantity(1);
            $rss_items = $rss->get_items(0, $maxitems);

            foreach ( $rss_items as $item ) :

                $code .= '  <article class="col-md-4 col-sm-6 col-xs-12" itemscope="" itemtype="http://schema.org/BlogPosting">
                                <div class="vendoritem">';
                $code .= '          <a href="' . esc_url( $item->get_permalink() ) . '"  target=' . "_blank".'>';
                $code .= '              <img width="300" height="225" src="' . get_first_image_url($item->get_description()) . '" class="img-responsive relat wp-post-image" style="background-color:#3498db;">';
                $code .= '          </a>
                                    <div class="vendoritem__details">
                                        <a href="' . esc_url( $item->get_permalink() ) . '" class="vendoritem__title" target=' . "_blank" . '>' . esc_html( $item->get_title() ) . '</a>
                                    </div>
                                </div>
                            </article>';

            endforeach;

        endif;
        /* End Loop */
    }

    $code .= '</div>';

    return $code;

    wp_reset_query();

}

My problem is i need to shoe only random 3 feed from table. but some time show me 2 feed, Why !!, and if any feed not work, how can get other feed from DB