include("top_foot.inc.php");
include("config.inc.php");
top();
$db = mysql_connect($db_host, $db_user, $db_password);
$Per_Page=1000;
$lingua=Italiano;
$reparto=Biblioteca;
$crit="lingua='".$lingua."' AND dove='".$reparto;
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri nel file config.inc.php");
//query per stabilire il numero totale di record trovati
$query = "SELECT COUNT(*) AS Total FROM globa WHERE ".$crit."' ORDER BY autore ASC";
$result = mysql_query($query, $db);
$row = mysql_fetch_array($result);
$Total=$row['Total'];
//echo "$criteri
";
echo "Totale record trovati per la lingua selezionata: $Total
";
//limitazione dei dati
$query = "SELECT id,titolo,autore,note FROM globa WHERE ".$crit."' ORDER BY autore,titolo ASC";
if (empty($_GET['Result_Set']))
{
$Result_Set=0;
$query.=" LIMIT $Result_Set, $Per_Page";
}else
{
$Result_Set=$_GET['Result_Set'];
$query.=" LIMIT $Result_Set, $Per_Page";
}
$result = mysql_query($query, $db);
$sql_rows =mysql_num_rows($result);
//echo "$sql_rows
";
//echo "$query
";
//visualizzazione dati
for ($i = 1; $i <= $sql_rows; $i++)
{
$row = mysql_fetch_array($result);
echo "
$row[autore]
$row[titolo]
$row[note]
";
}
// Crea Next / Prev Links and $Result_Set Value
if ($Total>0)
{
if ($Result_Set<$Total && $Result_Set>0)
{
$Res1=$Result_Set-$Per_Page;
echo "<< Indietro ";
}
// Calculate and Display Page # Links
$Pages=$Total / $Per_Page;
if ($Pages>1)
{
for ($b=0,$c=1; $b < $Pages; $b++,$c++)
{
$Res1=$Per_Page * $b;
echo "$c \n";
}
}
if ($Result_Set>=0 && $Result_Set<$Total)
{
$Res1=$Result_Set+$Per_Page;
if ($Res1<$Total)
{
echo " Avanti >>";
}
}
}
mysql_close($db);
foot();
?>