-
Notifications
You must be signed in to change notification settings - Fork 12
/
displaydata.php
59 lines (56 loc) · 1.61 KB
/
displaydata.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
$servername="localhost";
$username="root";
$password="";
$dbname="newdb";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//fetch from database
$sql = "SELECT * from bookdb";
$result = $conn->query($sql);
?>
<html>
</head>
<title>E-Library Display Section</title>
<link rel="stylesheet" type="text/css" href="css/display.css">
</head>
<body>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="">E-Library</a></li>
<li><a href="https://www.alapan.me/" target="_blank">Visit My Blog!</a></li>
</ul>
<div style="overflow-x:auto;">
<h1>Books Available for Free Download</h1>
<table width="100%" cellspacing="0" cellpadding="18">
<div class="header">
<th>Book Name</th>
<th>Book Description</th>
<th>Book Author</th>
<th>Book Language</th>
<th>Download Link</th>
<th>Uploader Name</th>
<th>Uploader Email</th>
</div>
<tr>
<?php
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>".$row['bookname']."</td>";
echo "<td>".$row['bookdesc']."</td>";
echo "<td>".$row['bookauthor']."</td>";
echo "<td>".$row['booklang']."</td>";
echo "<td><a href='http://localhost/Elibrary/files/".$row['bookfile']."'><b>Download E-Book</b></a></td>";
echo "<td>".$row['uploadername']."</td>";
echo "<td>".$row['uploaderemail']."</td>";
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>