问:我想通过选择类别在排球库中显示Android Google Map中的位置(纬度和经度)标记。
我无法获得单个选定项目的位置,但可以在地图中获得所有位置的标记。请帮助代码!
我的详细代码链接:http://stackoverflow.com/questions/33339535/how-to-select-specific-category-in-spinner-to-show-lat-lng-location-in-google
答:Treeid树纬度树经度树条件
1 12.33 17.22平衡
2 12.33 17.22健康
3 12.33 17.33
4 13.44 17.55健康
5 11.32 17.66不平衡
6 12.33 18.33健康
7 14.44 18.44健康
8 11.22 17.22平衡
我对代码进行了些微更改,如下所示:我可以“健康”,但如果选择“平衡”,则应该仅显示Balanced treeid和lat,
<?php
define('&#95;&#95; ROOT&#95;&#95;',dirname(dirname(&#95;&#95; FILE&#95;&#95;)));;
require&#95once(&#95;&#95; ROOT&#95;&#95;。'/ public&#95; html / Config.php');
//连接到mysql数据库
$ mysqli =新的mysqli(DB&#95; HOST,DB&#95; USER,DB&#95; PASSWORD,DB&#95; DATABASE);
// json响应数组
$ response = array();
$ sq =“从树的位置选择treeid,treelatitude,treelongitude(treecondition ='健康','平衡')”;
if(isset($&#95; POST ['treecondition'])){
//接收post参数
$ treecondition = $&#95; POST ['treecondition'];
//获取Google Map Marker的树详细信息
if($ stmt = $ mysqli-> query($ sq)){
如果($ stmt-> num&#95; rows){
while($ tree = $ stmt-> fetch&#95; assoc()){
$ treeItem = array();
$ treeItem [“ treeid”] = $ tree ['treeid'];
$ treeItem [“ treelatitude”] = $ tree ['treelatitude'];
$ treeItem [“ treelongitude”] = $ tree ['treelongitude'];
$ response [] = $ treeItem;
} echo json&#95; encode($ response);
}
}其他{
//找不到具有凭据的用户
$ response [“ error”] = TRUE;
“; $ response [” error&#95; msg“] =”树列表视图凭据错误。请重试!“;
echo json&#95; encode($ response);
}
$ mysqli-> close();
}