PHP - problema php httprequest

 
Vista:
sin imagen de perfil

problema php httprequest

Publicado por luis jose (1 intervención) el 07/01/2014 07:11:44
Buenas noches, soy nuevo en este foro y quería hacerles una consulta resulta que estoy realizando un proyecto en el cual yo tengo unos bares y unos artistas relacionados entre si ya que un artista se puede presentar en uno o muchos bares en fechas distintas y estoy tratando de reflejar la posicion del bar en google maps a traves de unas coordenadas(x,y) que tengo asociadas al bar en la base de datos, el problema esta en que cuando selecciono el artista en el combo box me trae los primeros parametros de la consulta pero cuando toca imprimir el mapa de google maps en javascript con mis coordenadas x,y que me traigo de la base de datos no lo imprime en le php.

Estoy tratando de realizarlo con ajax para que se refresque todo en la misma pagina les dejo aqui el codigo y muchas gracias de antemano.

----------------prueba.php-----------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<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="">
 
    <?php
 
        $conn = oci_connect('basededatos', '1234', 'localhost/XE');
        if (!$conn) {
            $e = oci_error();
            trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
 
        }
    ?>
    <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>

--------------------------- funcion en carga presentacion---------------------

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function carga_presentacion(valor){
 
    xmlhttp1=new XMLHttpRequest();
    xmlhttp1.onreadystatechange=function()
    {
        if (xmlhttp1.readyState >= 3 && xmlhttp1.status===200)
        {
            document.getElementById("presentaciones").innerHTML=xmlhttp1.responseText;
        }
    };
    xmlhttp1.open("POST","Impresion.php?q="+valor,false);
    xmlhttp1.send();
 
}

--------------------- funcion mapa de google maps--------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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_canvas"),
            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);
      }

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<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>';
 
 
                }
                $w++;
            }
            echo '</tr>';
            oci_free_statement($stid);
    //            
            oci_close($conn);
        }
 
        ?>
    </body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder