如何使用php在谷歌地图上显示gps信息

时间:2013-01-29 06:35:10

标签: php google-maps

我正在Android上编写应用程序,app将从移动设备获取信息gps并将其发送到服务器。服务器将信息存储到数据库中。然后,当用户访问网站上的信息时,它将占据此位置并显示在googlemap上。现在,我将gps和商店信息存储在数据库中。但问题是我不知道如何在谷歌地图上显示它们。

<?php
$hostname_localhost ="mysql12.000webhost.com";
$database_localhost ="a4602996_longvan";
$username_localhost ="a4602996_lv";
$password_localhost ="longvan2012";
$localhost = mysql_connect($hostname_localhost,$username_localhost,$password_localhost)
or
trigger_error(mysql_error(),E_USER_ERROR);

mysql_select_db($database_localhost, $localhost);
$sqlInsert= "select Kinhdo,Vido from gps where number = (SELECT  MAX(number) FROM    gps)";
$sql=mysql_query($sqlInsert);
if(mysql_num_rows($sql))
{
  echo "<pre />";
  while($row=mysql_fetch_assoc($sql))
  {
    $json[] = $row;
  }
  echo "</pre>";
}
print 'My longitude: '.$json[0]['Kinhdo']; 
print 'My latitude: '.$json[0]['Vido']; 
mysql_close();

?>

1 个答案:

答案 0 :(得分:0)

RTM?

这是google maps API: https://developers.google.com/maps/documentation/javascript/reference

这里有一个只有地图的基本示例: https://google-developers.appspot.com/maps/documentation/javascript/examples/map-language (阅读来源,用经度和纬度替换默认值)

这里有一个picto(标记)的例子: https://google-developers.appspot.com/maps/documentation/javascript/examples/icon-simple

祝你好运!