-
Notifications
You must be signed in to change notification settings - Fork 0
/
m.php
71 lines (68 loc) · 1.64 KB
/
m.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
60
61
62
63
64
65
66
67
68
69
70
71
<?php
$host = "host=127.0.0.1";
$port = "port=5432";
$dbname = "dbname=ko";
$credentials = "user=postgres password=peet";
$db = pg_connect("$host $port $dbname $credentials") ;
if(!$db) {
echo "Error : Unable to open database\n";
} else {
echo "Opened database successfully\n";
}
$sql =<<<EOF
SELECT * from kk;
EOF;
$ret = pg_query($db, $sql) ;
if(!$ret) {
echo pg_last_error($db) ;
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<style>
#map {
height: 400px;
width: 100%;
}
</style>
<h3>My Google Maps</h3>
<div id="map"></div>
<script>
// The following example creates a marker in Stockholm, Sweden using a DROP
// animation. Clicking on the marker will toggle the animation between a BOUNCE
// animation and no animation.
var marker;
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: {lat: 35.84486, lng: 128.594692}
});
<?php
$num_row = pg_num_rows($ret);
$k = 0;
while($row = pg_fetch_row($ret) ){
?>
marker = new google.maps.Marker({
map: map,
draggable: true,
animation: google.maps.Animation.DROP,
position: {lat:<?php echo $row["7"];?>, lng:<?php echo $row["8"];?>},
});
console.log('a');
<?php
}
?>
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBeVERtl6-MScPy5xT3ysrJsM4zRkcjGaY&callback=initMap">
</script>
</head>
<body>
<?php
pg_close($db) ;
?>
</body>
</html>