Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/01/2014, 07:51
lgonzalez64
 
Fecha de Ingreso: enero-2014
Mensajes: 1
Antigüedad: 10 años, 3 meses
Puntos: 0
Pregunta problema con google maps en php

Buenos días, quisiera que me ayudaran con esto, estoy haciendo un proyecto de base datos el cual trata sobre artistas y locales donde se han presentado o se podrían presentar, para mostrar la ubicación de los bares tengo que usar google maps, yo uso un combo box para almacenar los artistas y en función del artista seleccionado me traigo la consulta de la base de datos con el historial correspondiente pero cuando voy a imprimir el mapa de google maps en php no lo hace.

Muchas gracias de antemano, aquí les dejo el código, uso oracle 11g y netbeans.

---------prueba.php----------

<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="funcionesjavascript.js"></script>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA-Xa1rhkqmGgNmS1njvN27vDjx5XOF3Us&sensor=true">
</script>

</head>
<body onload="">
<!--<div id="map_canvas" style="width:300px; height:300px"></div>-->
<?php
// echo'<body onload="initialize1('.$valor.');">';
$conn = oci_connect('basededatos', '1234', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
// echo "pase1";
}
?>
<table >
<tr>
<td>
<select type="text" name="mes" id="mes" size="1" width="10" onchange="carga_presentacion(this.value);">
<option>Seleccione</option>
<?php
$stid = oci_parse($conn, 'begin :r := combo_nombre_artista; end;');
oci_bind_by_name($stid, ':r', $r, 10000);
oci_execute($stid);
echo $r;
oci_free_statement($stid);
//
oci_close($conn);
?>
</select>
</td>
</tr>

</table >
<table id="presentaciones">

</table>



</body>
</html>


--------------carga_presentacion----------


function carga_presentacion(valor){

xmlhttp1=new XMLHttpRequest();
xmlhttp1.onreadystatechange=function()
{
if (xmlhttp1.readyState >= 3 && xmlhttp1.status===200)
{
document.getElementById("presentaciones").innerHTM L=xmlhttp1.responseText;
}
};
xmlhttp1.open("POST","Impresion.php?q="+valor,fals e);
xmlhttp1.send();

}

--------------impresion.php---------------

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>

<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="funcionesjavascript.js"></script>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA-Xa1rhkqmGgNmS1njvN27vDjx5XOF3Us&sensor=true">
</script>
</head>
<body>
<?php
// put your code here

$id_artista = $_GET["q"];
$conn = oci_connect('basededatos', '1234', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
// echo "pase1";
}
else{
$stid = oci_parse($conn, 'begin :r := get_direccion_localidad(:id_artista); end;');
oci_bind_by_name($stid, ':id_artista', $id_artista, 10000);
oci_bind_by_name($stid, ':r', $r, 10000);
oci_execute($stid);
// echo $r;
// echo "<br/>";
function multiexplode ($delimiters,$string) {

$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
$exploded = multiexplode(array("*","+"),$r);
$w =0;
echo '<tr>';
for($j=0;$j<count($exploded);$j++){
if($w==2){
$coordx = str_replace(',', '.', $exploded[$j]);
echo '<td>'.$coordx.'</td>';

}
else if($w==3){
$coordy = str_replace(',', '.', $exploded[$j]);
$w=-1;
echo '<td>'.$coordy.'</td>';

echo'
<td>'.
'<div id="map_canvas" style="width:300px; height:300px"></div>'.
'<script type="text/javascript">initialize1('.$coordx.','.$coordy.');</script>'
.'</td>';
echo'</tr>';
echo'<tr>';
}
else{
echo'
<td>'.
$exploded[$j]
.'</td>';
// echo $exploded[$j];
// echo "<br/>";

}
$w++;
}
echo '</tr>';
oci_free_statement($stid);
//
oci_close($conn);
}

?>
</body>
</html>

--------------initialize1(x,y)---------------------

function initialize1(x,y) {

var mapOptions = {
center: new google.maps.LatLng(10.497567, -66.856681),
zoom: 18,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canva s"),
mapOptions);

var prueba = new google.maps.Marker({
position: new google.maps.LatLng(x, y),
// position: new google.maps.LatLng('10.497567', '-66.856681'),
map: map
});
google.maps.event.addDomListener(window, 'load', initialize);
}