Online Public Access Catalog
If you are looking for
Online Public Access Catalog for Library System or it's called OPAC then you are at the right place. We have a full source code for this kind of system
Online Public Access Catalog for Library System is for viewing and providing information about books, authors, and category inside the library.
This program works to provide the students the information of the book that we're gonna borrow, to know the status of the books inside the Library, and to know if the books are available or not. And, we display the image of the book in this program. The user can search by title, author, category, copyright year and the barcode of the books.
Creating our Table
For the first step, we are going to make our database.
To create a database:
- Open PHPMyAdmin
- Create a database and name it as "opac_db".
- After creating a database name, click the SQL and kindly copy the code below.
--
-- Table structure for table `book`
--
Sample Codes - PHP
This PHP source code is used for searching of the books. This is the syntax.
<?php
include('../admin/include/dbcon.php');
if(isset($_POST['search']))
{
$keyword = $_POST['keyword'];
$status = $_POST['status'];
if ($status == '--All--') {
LEFT JOIN category ON book.category_id = category.category_id
where (category.classname like '%$keyword%' or
(book_barcode like '%$keyword%' or book_title like '%$keyword%'
or author like '%$keyword%' or copyright_year like '%$keyword%'))
} elseif ($status == 'Title') {
LEFT JOIN category ON book.category_id = category.category_id
where book_title like '%$keyword%'
} elseif ($status == 'Author') {
LEFT JOIN category ON book.category_id = category.category_id
where author like '%$keyword%'
} elseif ($status == 'Category') {
LEFT JOIN category ON book.category_id = category.category_id
where classname like '%$keyword%'
} elseif ($status == 'Copyright') {
LEFT JOIN category ON book.category_id = category.category_id
where copyright_year like '%$keyword%'
} elseif ($status == 'Barcode') {
LEFT JOIN category ON book.category_id = category.category_id
where book_barcode like '%$keyword%'
} else {
LEFT JOIN category ON book.category_id = category.category_id
}
$book_id=$row['book_id'];
$cat_id=$row['category_id'];
?>
Database Connection
This is the script for our database connection.
If the user searching the title of the book. This is the output.

Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at
[email protected]. Practice Coding. Thank you very much.