Buongionro,

come da oggetto, non riesco a visualizzare il file che carico sul mio db.
La funzionalita che vorrei implemetare è un box di ricerca foto e visualizzazione selezionando da 2 menu a tendina.
Premettendo che sono pienamente in alta marea sul php...

download_file.php


<?php
$host = "localhost"; //nome dell'host, in locale con xampp è questo
$user = "root"; //di default mysql usa questo, se l'hai cambiato metti il tuo
$pass = ""; //di default mysql non ha la password settata, se l'hai impostata scrivila qui
$dbname = "test"; //il nome che hai dato al database
$conn = mysql_connect($host, $user, $pass) or die('Impossibile stabilire una connessione col database: ' . mysql_error());
mysql_select_db($dbname,$conn) or die('Impossibile selezionare il database: ' . mysql_error());




Sono in disperazione...Grazie a tutti!




$Categoria=$_POST["Categoria"];
$Citta=$_POST["Citta"];
// ESEGUIAMO LA QUERY DI INSERIMENTO
$result = @mysql_query("SELECT foto FROM foto WHERE Categoria = '".$Categoria."' AND Citta = '".$Citta."'") // SELEZIONA FOTO
or die("Errore sql : " .mysql_error());

echo $result;
while ($row = mysql_fetch_assoc($result)){
echo $row['NomeFile'];
}
// CHIUDIAMO LA CONNESSIONE A MYSQL
@mysql_close();


?>


<html>
<body>
<?php
header('Content-Length: '.strlen($result));
header("Content-type: image/jpeg");
// outputing image
echo $result;
exit();
?>
</body>
</html>



cerca.php

<?php





$host = "localhost"; //nome dell'host, in locale con xampp è questo
$user = "root"; //di default mysql usa questo, se l'hai cambiato metti il tuo
$pass = ""; //di default mysql non ha la password settata, se l'hai impostata scrivila qui
$dbname = "test"; //il nome che hai dato al database
$conn = mysql_connect($host, $user, $pass) or die('Impossibile stabilire una connessione col database: ' . mysql_error());
mysql_select_db($dbname,$conn) or die('Impossibile selezionare il database: ' . mysql_error());

$queryCitta = "SELECT Citta FROM Lazio";
$queryCategoria ="SELECT ID,DESCRIZIONE FROM Categoria";


$resultCitta = mysql_query($queryCitta) or die (mysql_error());
$resultCategoria = mysql_query($queryCategoria) or die (mysql_error());








// CHIUDIAMO LA CONNESSIONE A MYSQL
@mysql_close();

?>



<html>
<head>
<title>Form per l'inserimento</title>
</head>
<body>

<form enctype="multipart/form-data" action="download_file.php" method="post">
Citta
<select name="Citta" >
<?php

while ($row = mysql_fetch_array($resultCitta, MYSQL_NUM)) {
echo "<option value=\"".$row[0]."\">".$row[0]."</option>";
}

?>

</select>


Categoria
<select name="Categoria" >
<?php

while ($row = mysql_fetch_array($resultCategoria, MYSQL_NUM)) {
echo "<option value=\"".$row[0]."\">".$row[1]."</option>";
}

?>
</select>


<input type="submit" name="Scarica" value="Download" />
</form>





</body>
</html>