-
Notifications
You must be signed in to change notification settings - Fork 0
/
isbnarama.php
117 lines (94 loc) · 3.33 KB
/
isbnarama.php
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
include "php/meta.php";
include "php/header.php";
require_once 'baglan.php';
?>
<?php
if (isset($_GET['submit'])) {
$isbn = isset($_GET['isbn']) ? $_GET['isbn'] : null;
if (!$isbn) {
$hata = "Lütfen ISBN numarasını giriniz";
}
else {
$sorgu=$db->prepare('SELECT kitaplar.id,kitaplar.Adi AS kitapAdi,yazarlar.Adi,yazarlar.soyadi,kitaplar.Sayfa_Sayisi,kitaplar.Yayin_Tarihi,kitaplar.ISBN,kitaplar.LC,kategori.Adi AS kategoriAdi FROM kitaplar,yazarlar,kategori WHERE yazarlar.Id=kitaplar.Yazar_Id AND kategori.Id=kitaplar.Kategori_Id AND kitaplar.ISBN=?');
$sorgu->execute([$isbn]);
$kitaplar=$sorgu->fetchAll(PDO::FETCH_ASSOC);
$hata=null;
}
}
?>
<div class="container mt-5 mb-5 col-md-8 col-sm-12">
<?php
if (isset($_GET['submit']))
{
if ($hata!=null)
{
echo "<label class='alert alert-primary col-md-12 mt-2'><strong>".$hata."</strong></label>";
}
}
?>
<form method="get">
<div class="card">
<div class="card-header bg-warning text-center">ISBN/ISSN/ISMN Numarası İle Kitap Arama</div>
<div class="card-body">
<div class="container">
<div class="row">
<div class="col-12 mt-2 mb-4">
<div class="form-group">
<label class="label mb-2">ISBN/ISSN/ISMN NO:</label>
<input type="text" class="form-control mb-2" name="isbn">
<input type="hidden" value="1" name="submit">
<button type="submit" class="btn btn-dark col-md-3 mt-4 text-center offset-4">Ara</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<?php if(isset($_GET['submit'])){
if (!$isbn)
{
$hata = "null";
}
elseif ($isbn && empty($kitaplar)){
echo "<label class='alert alert-danger col-md-6 offset-md-3 text-center mb-5 text-dark'><strong>Kütüphanede Böyle Bir Kitap yoktur</strong></label>";
}
else{
?>
<div class="container mb-5">
<table class="table ">
<thead>
<tr>
<th>#</th>
<th>Kitap Adı</th>
<th>Yazar Adı</th>
<th>Sayfa Sayısı</th>
<th>Kategori Adı</th>
<th>ISBN</th>
<th>Raf Kodu</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
foreach ($kitaplar as $kitap):?>
<tr>
<th scope="row"><?php echo $kitap['id']?></th>
<td><?php echo $kitap['kitapAdi']?></td>
<td><?php echo $kitap['Adi']." ".$kitap['soyadi'];?></td>
<td><?php echo $kitap['Sayfa_Sayisi']?></td>
<td><?php echo $kitap['kategoriAdi']?></td>
<td><?php echo $kitap['ISBN']?></td>
<td><?php echo $kitap['LC']?></td>
<td><a href="detay.php?id=<?php echo $kitap['id'];?>" class="btn btn-primary col-12 text-center text-white">Detay</a></td>
</tr>
<?php endforeach;}}?>
</tbody>
</table>
</div>
<?php
include "php/footer.php";
include "php/end.php";
?>