-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetData.php
More file actions
23 lines (19 loc) · 732 Bytes
/
getData.php
File metadata and controls
23 lines (19 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
header("Content-Type: application/json; charset=UTF-8");
$conn = new mysqli("localhost", "root", "", "angularjs");
$result = $conn->query("SELECT * from crapdata");
$outp = "";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "") {$outp .= ",";}
$outp .= '{"Name":"' . ($rs["Name"]) . '",';
$outp .= '"Phone":"' . ($rs["Phone"]) . '",';
$outp .= '"Email":"' . ($rs["Email"]) . '",';
$outp .= '"Address":"' . ($rs["Address"]) . '",';
$outp .= '"City":"' . ($rs["City"]) . '",';
$outp .= '"Country":"' . ($rs["Country"]) . '",';
$outp .= '"Story":"'. ($rs["Story"]) . '"}';
}
$outp ='{"records":['.$outp.']}';
$conn->close();
echo($outp);
?>