Guest User

Untitled

a guest
Feb 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  5. <style type="text/css">
  6. #map {
  7. height: 400px;
  8. width: 100%;}
  9. </style>
  10. <script type="text/javascript"
  11. src="https://maps.googleapis.com/maps/api/js?key=replace_API_KEY&sensor=false">
  12. </script>
  13. <script type="text/javascript">
  14. function initialize() {
  15. var position_australia = {lat: -25.363, lng: 131.044};
  16. var position_angola = {lat: -14.458, lng: 16.709};
  17. var mapOptions = {
  18. center: position_australia,
  19. zoom: 4
  20. };
  21. var map = new google.maps.Map(document.getElementById("map"), mapOptions);
  22. }
  23.  
  24. function addMarker(lat, lng, info) {
  25. var location= new google.maps.LatLng(lat, lng);
  26. bounds.extend(location);
  27. var marker = new google.maps.Marker({
  28. map: map,
  29. position: location
  30. });
  31. map.fitBounds(bounds);
  32. bindInfoWindow(marker, map, infoWindow, info);
  33. }
  34.  
  35. // Displays information on markers that are clicked
  36. function bindInfoWindow(marker, map, infoWindow, info) {
  37. google.maps.event.addListener(marker, 'click', function() {
  38. infoWindow.setContent(info);
  39. infoWindow.open(map, marker);
  40. });
  41. }
  42. </script>`
  43.  
  44. </head>
  45. <body onload="initialize()" style="margin:0px; border:0px; padding:0px;">
  46. <div id="map"></div>
  47.  
  48. <?php
  49. $host="localhost";
  50. $user="user";
  51. $pass="pw;
  52. $db="db";
  53. $connection=mysqli_connect($host, $user, $pass) or die (mysqli_error());
  54. mysqli_select_db($connection, $db) or die (mysqli_error());
  55. mysqli_set_charset($connection, "utf8");
  56.  
  57. $query_3=mysqli_query($connection, "SELECT * FROM countries2 WHERE short LIKE '$value_short_nocomma'") or die("MySQL error: " . mysqli_error($dbc) . "<hr>nQuery: $query");;
  58. while ($row=mysqli_fetch_array($query_3))
  59. {
  60. $lat = $row["lat"];
  61. $lng = $row["lng"];
  62. $content = $row["content"]
  63. }
  64. echo "<script> addMarker($lat, $lng, $content); </script>";
  65. }
  66. ?>
  67. </body>
  68. </html>
Add Comment
Please, Sign In to add comment