erectheum
Security Tools Creator
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
300 XP
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:
Sample Codes - PHP
This PHP source code is used for searching of the books. This is the syntax.
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.
Download
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`
- --
- CREATE
TABLE
[url=http://dev.mysql.com/doc/refman/%35%2E%31/en/control-flow-functions.html]IF
NOT
EXISTS
[/url] `book`
(
- `book_
id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
- `book_
title`
varchar
(
100
)
NOT
NULL
,
- `category_
id`
int
(
50
)
NOT
NULL
,
- `author`
varchar
(
50
)
NOT
NULL
,
- `author_
2`
varchar
(
100
)
NOT
NULL
,
- `author_
3`
varchar
(
100
)
NOT
NULL
,
- `author_
4`
varchar
(
100
)
NOT
NULL
,
- `author_
5`
varchar
(
100
)
NOT
NULL
,
- `book_
copies`
int
(
11
)
NOT
NULL
,
- `book_
pub`
varchar
(
100
)
NOT
NULL
,
- `publisher_
name`
varchar
(
100
)
NOT
NULL
,
- `isbn`
varchar
(
50
)
NOT
NULL
,
- `copyright_
year`
int
(
11
)
NOT
NULL
,
- `status`
varchar
(
30
)
NOT
NULL
,
- `book_
barcode`
varchar
(
100
)
NOT
NULL
,
- `book_
image`
varchar
(
100
)
NOT
NULL
,
- `date_
added`
datetime
NOT
NULL
,
- `remarks`
varchar
(
100
)
NOT
NULL
,
- PRIMARY KEY
(
`book_
id`
)
- )
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
latin1 AUTO_INCREMENT
=
8
;
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--'
)
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- where (category.classname like '%$keyword
%' o
r
- (book_barcode like '%$keyword
%' o
r book_title like '%$keyword
%'
- or author like '%$keyword
%' o
r copyright_year like '%$keyword
%'))
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
elseif
(
$status
==
'Title'
)
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- where book_title like '%$keyword
%'
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
elseif
(
$status
==
'Author'
)
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- where author like '%$keyword
%'
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
elseif
(
$status
==
'Category'
)
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- where classname like '%$keyword
%'
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
elseif
(
$status
==
'Copyright'
)
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- where copyright_year like '%$keyword
%'
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
elseif
(
$status
==
'Barcode'
)
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- where book_barcode like '%$keyword
%'
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
else
{
- $result
=
mysql_query
(
"select * from book
- LEFT JOIN category ON book.category_id = category.category_id
- order by book.book_id DESC "
)
or die
(
mysql_error
(
)
)
;
- }
- $return_count
=
mysql_num_rows
(
$result
)
;
- while
(
$row
=
mysql_fetch_array
(
$result
)
)
{
- $book_id
=
$row
[
'book_id'
]
;
- $cat_id
=
$row
[
'category_id'
]
;
- ?>
Database Connection
This is the script for our database connection.
- <?php
- mysql_select_db
(
'opac_db'
,
mysql_connect
(
'localhost'
,
'root'
,
''
)
)
or die
(
mysql_error
(
)
)
;
- ?>
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.
Download
You must upgrade your account or reply in the thread to view hidden text.