forked from Habibah28/Upload-Download-PDF-File-Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetPDF.php
More file actions
33 lines (22 loc) · 713 Bytes
/
Copy pathgetPDF.php
File metadata and controls
33 lines (22 loc) · 713 Bytes
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
<?php
require_once 'Config.php';
//connecting to the db
$con = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_NAME) or die("Unable to connect");
//sql query
$sql = "SELECT * FROM YOUR-TABLE-NAME";
//getting result on execution the sql query
$result = mysqli_query($con,$sql);
//response array
$response = array();
$response['error'] = false;
$response['message'] = "PDfs fetched successfully.";
$response['pdfs'] = array();
//traversing through all the rows
while($row =mysqli_fetch_array($result)){
$temp = array();
$temp['id'] = $row['id'];
$temp['url'] = $row['url'];
$temp['name'] = $row['name'];
array_push($response['pdfs'],$temp);
}
echo json_encode($response);