Sorted. I didnt have the correct path to the showproducts.php file!

I have a php header file that displays a random image from a mysql table each time the page is reloaded. I have done this just using rand() in the query. But doing it like this means that the same image could come up 3,4,5 times in a row! How would i make it random but never have an image come up twice in a row?

This is my file

   $output = '<div class="header">';
   $output .= '<img src="../images/siteimages/logo.png"alt="Logo image" />';
   $output.= '<div id="headerrotator">';
   include 'connect.php';
   $q ="SELECT * FROM headerrotatorimage WHERE rotator = 1 AND status = 1 ORDER BY RAND() LIMIT 1" or die (mysqli_error($link));
   $result = $link->query($q);

   while($row = mysqli_fetch_array($result)){
   $output .= "<img src='{$row['filename']}' alt='{$row['name']}. image' />";
   $output.= '</div>';
   $output.= '<div id="wishlistmenu">';
   $output.= '<ul>';
   $output .= '<li><a href="wishlist.php">Login/Register</a> </li>';
   $output .= '<li><a href="wishlist.php">Wish List</a> </li>';
   $output .= '<li><a href="wishlist.php">Reviews/Testing</a> </li>';
   $output .= '<li><a href="wishlist.php">View Cart</a> </li>';
   $output .= '<li><a href="wishlist.php">Terms/Delivery</a> </li>';
   $output .= '<li><a href="wishlist.php">Contact Us</a> </li>';
   $output.= '</ul>';
   $output.= '</div>';
   $output .= '</div>';

   echo $output;

Thanks for looking.................

Yeah, kind of impatient of me! This got sorted last night thanks to pixiesoul.