Ho provato, ma non funziona ancora. L'errore è: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY RAND() limit 2' at line 1. Poi ho provato ad eliminarecodice:<? include 'config.php'; $catList = array('Paesaggi', 'Ritratti'); $catList=array_rand($catList); $catSel=$catList[0]; $sql = "SELECT foto_id,foto_nome,foto_size,foto_type, foto, foto_cat,foto_naz FROM img WHERE foto_cat = ".$catSel." ORDER BY RAND() limit 2"; $result = @mysql_query($sql) or die(mysql_error ()); while($row = @mysql_fetch_array($result)){ $id_img = $row['foto_id']; $type = $row['foto_type']; $img = $row['foto']; if (!$id_img) { echo "Id sconosciuto"; }else{ header ("Content-type: ".$type); echo $img; } } ?>ma così facendo, si vede del codice anziché lìimmagine. Ho provato alcune modifiche in un file base (dove è data una sola categoria), ma ancora si visualizza solo una foto. Altre idee.codice:header ("Content-type: ".$type);