-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_book.php
More file actions
39 lines (33 loc) · 1.05 KB
/
add_book.php
File metadata and controls
39 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include('db_conn.php');
?>
<?php
$book_id = $_POST['book_id'];
$isbn = $_POST['isbn'];
$title = $_POST['title'];
$author = $_POST['author'];
$edition = $_POST['edition'];
$status = $_POST['status'];
$copies = $_POST['copies'];
$keyword = $_POST['keyword'];
$query10 = "SELECT * FROM `book` WHERE `book_id`='$book_id'";
$result10 = mysql_query($query10);
$count10 = mysql_num_rows($result10);
if($count10!=0){
$message = "Entry already exist";
echo "<script type='text/javascript'>window.confirm('$message');</script>";
/* exit("<script type='text/javascript'>alert('$message');</script>"); */
/* header('location:add_lab.html'); */
echo "<script type='text/javascript'>window.location.href=\"add_book.html\";</script>";
die();
}
else
{
$query3 = "INSERT INTO book (isbn,title,author,edition,status,copies,keyword) VALUES('$isbn','$title','$author','$edition','$status','$copies','$keyword')";
$result3 = mysql_query($query3);
if($result3)
{
header('location:add_book.html');
}
}
?>