-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
59 lines (41 loc) · 1.96 KB
/
index.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
<?php
session_start();
include_once('head.php');
include('connection.php');
?>
<link rel="stylesheet" href="css/index.css"/>
<!--<script src="js/dragndrop.js" defer></script>-->
<body class="container">
<?php include_once('elements/header.php') ?>
<div class="content">
<?php
$user_id = $_SESSION['user_id'];
$books = array();
$query = 'SELECT book_id, name, adress, account FROM Books WHERE owner_id = '.$user_id.'';
$userdata = mysqli_query($conn, $query);
if (mysqli_num_rows($userdata) > 0) {
foreach (mysqli_fetch_all($userdata) as $row) {
array_push($books, $row);
}
foreach ($books as $book) {
$book_id = $book[0];
echo '<div class="card draggable" draggable="false">
<div class="card-content-wrapper">
<h3>'.$book[1].'</h3>
<p>'.$book[2].'</p>
<p>Счёт '.$book[3].'</p>
<a href="book.php?user_id='.$user_id.'&book_id='.$book_id.'" class="btn1">Подробнее</a><br><br>
<a href="remove_book.php?user_id='.$user_id.'&book_id='.$book_id.'" class="link">Удалить</a>
</div>
</div>';
}
}
#print_r($books);
?>
<div class="card draggable" draggable="false">
<a href="createbook.php" class="add-btn" title="Добавить книжку">+</a>
</div>
</div>
<?php include_once('elements/footer.php') ?>
</body>
</html>