Codice PHP:
<? 
include 'config.php'
$catList = array('Paesaggi''Ritratti');  
$catList=array_rand($catList);  
$catSel=$catList[0]; 
$result=mysql_query("SELECT * FROM img WHERE foto_cat='$catSel' ORDER BY RAND() LIMIT 2") or die ("Errore query"); 
while(
$row=mysql_fetch_array($result)){
     
$id_img $row['foto_id']; 
     
$type $row['foto_type']; 
     
$img $row['foto']; 
     
header ("Content-type: ".$type); 
     echo 
$img
}
?>
Prova questo e vedi se ti da errori