l'intero codice è questo:
home.php
<link href="stile.css" rel="stylesheet" type="text/css">
<?php
@mysql_connect("localhost", "root", "") or die("Connessione fallita !");
@mysql_select_db("PORTALE") or die("Selezione Database fallita !");
$sql="SELECT * from news where pub='1'";
$select = @mysql_query($sql) or die("Query fallita !");
while($riga=mysql_fetch_array($select)){
$idn1=$riga["idn1"];
$titolo1=$riga["titolo1"];
$short=$riga["mini1"];
echo"<table height=\"84\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\">";
echo" <tr>";
echo" <td width=\"100%\" bgcolor=\"#FF6600\" height=\"19\">";
echo" <p align=\"left\"> News</td>";
echo" </tr>";
echo" <tr>";
echo" <td width=\"100%\" height=\"64\">";
echo" <table width=\"75%\" border=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" cellpadding=\"0\" cellspacing=\"0\">";
echo" <tr>";
echo" <td class=\"titolo\">$titolo1</td>";
echo" </tr>";
echo" <tr>";
echo"<td class=\"newstesto\"> <A HREF=\"notizie2.php?idn1=$idn1\"> $short</td>\n";
echo" </tr>";
echo" </table>";
echo" <p align=\"left\">";
echo"</td>";
echo" </tr>";
echo" </table>";
}
?>
stampafoto.php
<?php
@mysql_connect("localhost", "root", "") or die("Connessione fallita !");
@mysql_select_db("PORTALE") or die("Selezione Database fallita !");
//$query = "SELECT idn1,foto, Type from news where idn1='$idn1'";
$query = "SELECT foto, Type from news where idn1='$idn1'";
$select = @mysql_query($query) or die("Query fallita !");
$result = @mysql_fetch_array($select);
$data= $result["foto"];
$type = $result["Type"];
Header("Content-type: $type");
echo $data;
?>
notizie2.php
<?php
$query = "SELECT foto,news1, Type from news where idn1='$idn1'";
@mysql_connect("localhost", "root", "") or die("Connessione fallita !");
@mysql_select_db("PORTALE") or die("Selezione Database fallita !");
$query = "SELECT news1 from news where idn1='$idn1'";
$select = @mysql_query($query) or die("Query fallita !");
$result = @mysql_fetch_array($select);
$notizia=$result["news1"];
//$idn1=$result["idn1"];
$foto=$result["foto"];
list( $width, $height, $type ) = getimagesize( $foto );
echo $width;
echo "<img src=stampafoto.php?idn1=$idn1 >"; //carica l'immagine
echo"
";
echo"
";
echo $notizia;
?>