Biblioteca |

Biblioteca online

Catalogo Dewey


prepare("SELECT COUNT(*) as n FROM Libri"); $stmt->execute(); $data = $stmt->fetch(); $vols = $data["n"]; $stmt = $pdo->prepare("SELECT COUNT(*) as n FROM Libri WHERE length(Dewey)>0"); $stmt->execute(); $data = $stmt->fetch(); $dewey = $data["n"]; echo "Volumi: " . $vols.", di cui ".$dewey." (".round($dewey/$vols*100)."%) collocati nella calssificazione dewey"; $vols = $data["n"]; ?>

prepare("SELECT COUNT(DISTINCT Autore) as n FROM Libri"); $stmt->execute(); $data = $stmt->fetch(); echo "Autori: " . $data["n"]; ?>


setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $q=$pdo->prepare("SELECT Titolo, id, Autore, Dewey FROM Libri WHERE length(Dewey)>0 GROUP BY Titolo ORDER BY Dewey ASC"); $q->execute(); $map = []; foreach($q->fetchAll(PDO::FETCH_ASSOC) as $e){ $map[$e["Dewey"][0]][$e["Dewey"][1]][$e["Dewey"][2]].= "".htmlentities($e["Dewey"])." - ".htmlentities($e["Titolo"])." ".htmlentities($e["Autore"])."
"; } $out=""; $toc = ""; echo $toc; ?>