-
Notifications
You must be signed in to change notification settings - Fork 0
/
books.php
27 lines (21 loc) · 911 Bytes
/
books.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
<?php
include '../backend/database.php';
include '../logic/listbooks.php';
$conn= connect();
$result = getBooks($conn);
header("Connect-Type: JSON");
$rowNumber = 0;
$output = array();
while($row = mysqli_fetch_array($result)){
$output[$rowNumber]['ISBN'] = $row['ISBN'];
$output[$rowNumber]['Book_name'] = $row['Book_name'];
$output[$rowNumber]['author_name'] = $row['author_name'];
$output[$rowNumber]['genre'] = $row['genre'];
$output[$rowNumber]['date_borrowed'] = $row['date_borrowed'];
$output[$rowNumber]['date_returned'] = $row['date_returned'];
$output[$rowNumber]['no_of_copies_rented'] = $row['no_of_copies_rented'];
$output[$rowNumber]['no_of_copies_bought'] = $row['no_of_copies_bought'];
$rowNumber++;
}
echo json_encode($output, JSON_PRETTY_PRINT);
?>