faccio prima a fartela vedere
codice:
function image()
{

	$sql = "SELECT Max(pid) as MaxId, Min(pid) as MinId FROM ".$prefix."pictures";
	$result = mysql_query($sql,$db);
	$row = mysql_fetch_array($result);
	$id = intval(rand($row[MinId],$row[MaxId]));
	
	
	/* Query Database */
	
	$query = "SELECT pid,filepath,filename FROM ".$prefix."pictures WHERE pid='$id'";
	
	
	/* Results */
	$result = mysql_query($query, $db);
	$row = mysql_fetch_array($result);
	
	if ($row['filepath'] != "")
	{
		echo "<a href=\"$host\">
<img src=\"$host/albums/$row[filepath]thumb_$row[filename]\" border=\"1\"
width=\"150\"
height=\"100\" style=\"-moz-opacity:0.3;
filter:alpha(opacity=30);\" onMouseOver=\"this.style.MozOpacity=1;
this.filters.alpha.opacity=100\" onMouseOut=\"this.style.MozOpacity=0.3;
this.filters.alpha.opacity=30\"></a>";
	}
	else
	{
		image();
	}
}
come lo sistemeresti?