$sql = "select * from pubs where clientid='$clientid' LIMIT 0,10"; if( ! isset($arr_request[r]) ) $rand = (int)((double) microtime() * 10000000); else $rand = $arr_request[r]; $entries = 0; if( $result = mysql_query($sql, $link_mysql) ) $entries = mysql_num_rows($result); $pubs = array(); $index = array(); if( $entries > 0 ) { while( $rs = mysql_fetch_array($result) ) { $pubs[] = $rs; } srand($rand); $index = array_rand($pubs, 3); echo "
"; print_r($index); echo ""; } $c = count($index); if(! isset($arr_request[s]) ) $start = 0; else { $start = $arr_request[s] + 1; if( $start >= $c ) { $start = 0; } } if( $c == 0 ) $s = 0; ?>