안녕하세요, geo 위치로 작업하는 Google 길 찾기를 시도하면서 geolocation 부분을 완료했습니다. 길 찾기와 연결되어 잘 작동합니다. 문제는 동적으로 만들려고 할 때입니다. 다른 페이지에 대한 다른 개체에 대한 방향을 가져옵니다 난 그냥 일할 수 없어 thoguht 내가 jsut destintion의 spection에있는에 버블을 echo 할 수 있고 그것이 될 것이지만 그것은 소스 코드에서 destintion은 varible하지 콘텐츠 . 내 코드 Heres는PHP가 포함 된 Google 길 찾기
<?php $rows = mysql_fetch_array($results) or die(mysql_error());
echo '<script>';
echo 'if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(function (position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
var coords = new google.maps.LatLng(latitude, longitude);
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer();
var mapOptions ={
zoom: 15,
center: coords,
mapTypeControl: true,
navigationControlOptions:{
style: google.maps.NavigationControlStyle.SMALL
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById(\'panel\'));
var request = {
origin: coords,';
$geo = $rows['GEO'];
echo 'destination: \'$geo\',
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
});
}
google.maps.event.addDomListener(window, \'load\', initialize);';
echo '</script>';
?>
사람이 메신저 알려 도움을 주셔서 감사를 주시기 바랍니다 잘못하고 무엇을 볼 수 있다면.
편집
내 쿼리는 등
마을처럼 단지 이름, 또는 쇼핑 데이터베이스 GEO 밤은 지리적 위치에$id = $_GET["id"] ;
$sql = "SELECT * FROM Posts where id = $id" ;
$results = mysql_query($sql) or die(mysql_error()) ;
(그것에 작품 페이지에있는 다른 모든 것을 보여줍니다)
큰 코드 블록을 반향 출력하는 것이 일반적으로 권장되지만, 작은 따옴표가있는 문자열에는 변수를 포함 할 수 없으며 이중 변수 만 포함 할 수는 없습니다. – doublesharp
^"에코하지 않는다"는 말은 내 말을 의미하는 것입니다. – doublesharp