I am trying to make a random function generator for php... that will show a different picture everytime.. instead of like showing 2 different ones, and then picking one it has already shown. Meaning pretty much go through all the pictures before circling back through the others, now I don't want it to go down the list.. like pic1, pic2, but I Don't want it to show certain pictures over and over

here is some of the code I have.. it works for randomizing, but I need to add some variables or something that will keep it from showing over and over... anyone good with this and can help out?!

PHP Code:
function getRandomUser()
$connection mysql_pconnect(SQL_SERVERSQL_UIDSQL_PWD);
$sql "select * from user where active=1 and inrotation = 1";
$query mysql_query($sql);
$rows mysql_num_rows($query);
    if (
        return Array(
$row rand(0$rows 1);
$record mysql_fetch_array($query);

what it is doing above is calling to the database.. to the "user table" userid is there id number like in vb, and username is the same.. actually the user table is a replica of the vb's user table

so can anyone help out in this department?!@