创建互斥的图像幻灯片(同时显示两个图像,不能相同)

Thanks for helping in advance. This is a similar question asked by someone else recently, (Random Switch Statement Improvements?) but the solutions provided over there did not do the trick for me.

In case you don't feel like going to that page, here's the problem. I have a 2 slideshow images, one on top of the other. I want those images to never be the same, either on page load or as the slideshow shuffles through for infinity.

I've tried adding

"ORDER BY rand() LIMIT 2"

and that only made the slideshow images disappear.

Here's the code:

$getRugInfo = "SELECT f_name, l_name, city, zipcode, dfd.name as state_id, rug_types, profile_photo, profile_url, prt.rating  FROM rug_owners ps 
left join rug_states pst on dfd.state_id = ps.state_id left join rug_reviews 
prt on dfd.user_id = ps.user_id  WHERE promoted_rug = 1 ORDER BY ";  


$range_values = range(1,6);
shuffle($range_values);
$pickRug=array_pop($range_values);

 // I tried doing the code above, but it did not make the slideshow images mutually exclusive.  THe same two images would show up on occasion.  

$pickRug = mt_rand(1, 5);

switch($pickRug) {
case 1:
    $getSliderInfo .= "f_name";
    break;
case 2:
    $getSliderInfo .= "l_name";
     break;
case 3:
    $getSliderInfo .= "city";
    break;
case 4:
    $getSliderInfo .= "profile_photo";
    break;
case 5:
    $getSliderInfo .= "city DESC";
    break;
}

$sliderResult = mysql_query($getSliderInfo); // calls the slideshow

$link_address = $row["profile_url"];

Then it is the same thing as above for the second slideshow image (the image on bottom)

Here is the Jquery to create the slideshow:

 <script>
    jQuery('#Slider').cycle({ 
    fx:     'fade', 
    speed: 3000
});
    jQuery('#Slider2').cycle({ 
    fx:     'fade', 
    speed: 3000
});
</script>

Again, it's basically the same problem the other person had in the link provided above, it's just that the solutions provided did not work.`

Try to increase the range of random numbers and adjust the switch statement like below:

$pickRug = mt_rand(1, 15);

switch($pickRug) {
    case 1:
    case 4:
    case 7:
        $getSliderInfo .= "f_name";
        break;
    case 2:
    case 5:
    case 8:
        $getSliderInfo .= "l_name";
         break;
    case 3:
    case 6:
    case 9:
        $getSliderInfo .= "city";
        break;
    case 10:
    case 12:
    case 14:
        $getSliderInfo .= "profile_photo";
        break;
    case 11:
    case 13:
    case 15:
        $getSliderInfo .= "city DESC";
        break;
}

This jumbling will give you more unique result.

Hope this will help you !!