query("SELECT id, title, date(timestamp), author_sort, strftime('%Y',pubdate) AS pubyear, date(last_modified) FROM books WHERE id = '$ItemID'"); while ($row = $book->fetchArray()) { $row_id = $row['id']; $row_title = $row['title']; $row_created = $row['date(timestamp)']; $row_author_sort = $row['author_sort']; $row_pubdate = $row['pubyear']; $row_modified = $row['date(last_modified)']; } // ---------- Pull data from authors table ---------- $author = $db->query("SELECT name FROM authors INNER JOIN books_authors_link ON books_authors_link.author = authors.id WHERE books_authors_link.book = '$ItemID'"); while ($row = $author->fetchArray()) { $row_creator = $row['name']; } // ---------- Pull data from comments table ---------- $summary = $db->query("SELECT text FROM comments WHERE book = '$ItemID'"); while ($row = $summary->fetchArray()) { $row_summary = $row['text']; } // ---------- Pull data from publishers table ---------- $publisher = $db->query("SELECT name from publishers INNER JOIN books_publishers_link ON books_publishers_link.publisher = publishers.id WHERE books_publishers_link.book = '$ItemID'"); while ($row = $publisher->fetchArray()) { $row_publisher = $row['name']; } // ---------- Pull data from tags table ---------- $tags = $db->query("SELECT name FROM tags INNER JOIN books_tags_link ON books_tags_link.tag = tags.id WHERE tags.name NOT LIKE 'infopump%' AND books_tags_link.book = '$ItemID'"); // ---------- Pull data from tags table for Similar items ---------- // New similar tags query $similartags = $db->query("SELECT name FROM tags WHERE name IN (SELECT name FROM tags INNER JOIN books_tags_link ON books_tags_link.tag = tags.id AND books_tags_link.book = '$ItemID' ORDER BY RANDOM() LIMIT 2)"); $simtag = array(); while($row = $similartags->fetchArray()) { $simtag[] = $row['name']; } $getsimilar = $db->query("SELECT books.id, title, author_sort FROM books INNER JOIN books_tags_link ON books_tags_link.book = books.id INNER JOIN tags ON tags.id = books_tags_link.tag WHERE (tags.name LIKE '$simtag[0]' OR tags.name LIKE '$simtag[1]') AND books.id != '$ItemID' LIMIT 4"); // ---------- Pull data from identifiers table ---------- $identifiers = $db->query("SELECT type, val FROM identifiers WHERE book = '$ItemID'"); // ---------- Pull data from languages table ---------- $languages = $db->query("SELECT languages.lang_code AS lang_code FROM languages INNER JOIN books_languages_link ON books_languages_link.lang_code = languages.id WHERE book = '$ItemID' ORDER BY books_languages_link.item_order"); // ---------- Pull data from tags table to dertermine type ---------- $type = $db->query("SELECT custom_column_1.value AS itemtype FROM books_custom_column_1_link INNER JOIN custom_column_1 ON custom_column_1.id = books_custom_column_1_link.value WHERE books_custom_column_1_link.book = '$ItemID'"); while ($row = $type->fetchArray()) { $row_type = mb_convert_case($row['itemtype'], MB_CASE_TITLE, "UTF-8"); } // ---------- Pull series information ---------- $series = $db->query("SELECT series.name AS series, books.series_index AS seriesindex FROM series INNER JOIN books_series_link ON books_series_link.series = series.id INNER JOIN books ON books.id = books_series_link.book WHERE books_series_link.book = '$ItemID'"); while ($row = $series->fetchArray()) { $row_series = $row['series']; $row_seriesindex = $row['seriesindex']; } // ---------- Pull publisher location information ---------- $publisher_location = $db->query("SELECT custom_column_2.value AS publoc FROM books INNER JOIN books_custom_column_2_link ON books_custom_column_2_link.book = books.id INNER JOIN custom_column_2 ON custom_column_2.id = books_custom_column_2_link.value WHERE books.id = '$ItemID'"); while ($row = $publisher_location->fetchArray()) { $row_publocation = $row['publoc']; } // ---------- Pull subtype information ---------- $subtype = $db->query("SELECT custom_column_3.value AS subtype FROM books INNER JOIN books_custom_column_3_link ON books_custom_column_3_link.book = books.id INNER JOIN custom_column_3 ON custom_column_3.id = books_custom_column_3_link.value WHERE books.id = '$ItemID'"); while ($row = $subtype->fetchArray()) { $row_subtype = $row['subtype']; } // -------------------- END DATABASE QUERIES -------------------- ?>
'; ?> ';?> '; ?> '; ?> '; ?> '; ?> '; ?> '; ?> '; ?> '; ?> '; ?> '; ?> fetchArray()) { $row_id_type = $row['type']; $row_id_val = $row['val']; if ($row_id_type == 'isbn') { echo ''; } } ?> Item Record: '.$row_title.''; ?>Note: You may need to slightly edit citations for final use. Citations are based upon available data. Refer to your format guides for proper bibliographic citations.
'.$row_author_sort.'. '.$row_title.'. '.$row_publocation.': '.$row_publisher.', '.$row_pubdate.'.