-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget-data.php
More file actions
35 lines (31 loc) · 1006 Bytes
/
get-data.php
File metadata and controls
35 lines (31 loc) · 1006 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
34
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT Nome, Investimento_total, Latitude, Longitude FROM EMPREENDIMENTO NATURAL JOIN UF";
$result = $conn->query($sql);
$output = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo json_encode(
$row["Nome"] . ',' .
$row["Investimento_total"] . ',' .
$row["Latitude"] . ',' .
$row["Longitude"] . ';' .
//$row["Imagem_Bandeira"] . ';' .
'<br>'
);
}
//print json_encode(array_values($output));
} else {
echo json_encode(0);
}
$conn->close();
?>