Questo è il file valuta.PHP
$parte="FROM film where genere like'%$genere%'";
header("Location: http://localhost/database_film/tesse...ato.PHP?parte=$parte");
questo è il codice della pagina viewtesserato:
<?
ob_start();
include("..\config.PHP");
include("..\selezione.PHP");
$parte=isset( $_GET['parte'] ) ? $_GET['parte'] : '';
echo $parte;
if (!isset($_GET['start']) OR $_GET['start']<0) {
$start=0;
$step=15;
} else {
$start=intval($_GET['start']);
$step=15;
}
if(!isset($_GET['forma_query'])){
$forma_query="SELECT id, titolo, genere, attore1, attore2, attore3, regia, durata ".$parte;
}
else{
$forma_query=$_GET['forma_query'];
}
$dato3=$forma_query." order by titolo asc LIMIT $start, $step";
echo $dato3;
$query=mysql_query($dato3) OR DIE ("select Non Riuscita");
?>
<html>
<head>
<title>ELenco Films </title>
</head>
<body>
<div align="center">
<font color="#000099" size="+6" face="Arial, Helvetica, sans-serif">Risultati
Ricerca </font></p>
</div>
<div align="center"></div>
<div align="center">
<table width="777" border="1" cellpadding="0" cellspacing="1" bordercolor="#000099">
<tr bordercolor="#000099" bgcolor="#FFFFFF">
<td width="240">
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Nome</font></div></td>
<td width="106">
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Genere</font></div></td>
<td width="270">
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Attori</font></div></td>
<td width="59"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Durata</font></td>
<td width="59"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Operazioni</font></td>
</tr>
<?
while ($row=mysql_fetch_array($query))
{
echo "<tr bgcolor='#FFFFFF'>";
echo "<td width='280'> <font face='Arial, Helvetica, sans-serif' size='2' color='#000000'> $row[titolo]</font></td>";
echo "<td width='80'><font face='Arial, Helvetica, sans-serif' size='2' color='#000000'> $row[genere]</font></td>";
echo "<td width='300'><font face='Arial, Helvetica, sans-serif' size='2' color='#000000'> $row[attore1],$row[attore2],$row[attore3]</font></td>";
echo "<td width='80'><font face='Arial, Helvetica, sans-serif' size='2' color='#000000'> $row[durata]</font></td>";
echo"<td colspan=\"1\">";
echo "<a href=\"..\dettagli.php?id=$row[id]\" target=\"_top\"><font face='Arial, Helvetica, sans-serif' size='2' color='#000000'>Dettagli</font></a>";
echo"</td>";
echo"</tr>";
}
?>
</table>
</div>
<div align="center">
<table width=37% border=0 align="center">
<tr>
<td width=29% align=left>
<?
if ($start>0)
{
$start_back = $start - $step;
echo " <a href=\"viewtesserato.php?start=$start_back&forma_q uery=$forma_query&parte=$parte\">Precedenti</a>";
}
?>
<?
$dato2="SELECT count(*) AS tot ".$parte;
$query1=mysql_query($dato2) OR DIE(mysql_error());
$row=mysql_fetch_array($query1);
$pages=intval(($row["tot"]-1) / $step)+1;
?>
<td width=38% align=center>
<?
for ($i=0; $i<$pages AND $i<20; $i++)
{
$start_page = $i * $step;
echo "<a href=\"viewtesserato.php?start=$start_page&forma_q uery=$forma_query&parte=$parte\">" . ($i+1) . "</a> ";
}
?>
</td>
<td width=33%>
<?
if ($start + $step < $row["tot"])
{
$start_next = $start + $step;
echo "<a href=\"viewtesserato.php?start=$start_next&forma_q uery=$forma_query&parte=$parte\">Successivi</a>";
}
mysql_close();
?>
</td>
</tr>
</table>
</div>
<table width="187" border="0" align="center">
<tr>
<td width="181"><div align="center"><a href="ricercatesserato.PHP"><font face="Arial, Helvetica, sans-serif">Ritorna
alla ricerca</font></a></div></td>
</tr>
</table>
</body>
</html>