Title: PHP code in javascript (google maps)
Last modified: August 19, 2016

---

# PHP code in javascript (google maps)

 *  [rrijke](https://wordpress.org/support/users/rrijke/)
 * (@rrijke)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/php-code-in-javascript-google-maps/)
 * Hi there,
 * I have a wpmu website and I created an extra page template to include queries
   so i can pull data from another database. It all works fine.
 * But when trying to integrate Google maps i see that it is not processing the 
   PHP that’s included in the javascript needed to generate the google map.
 * Does anyone know what to do about this?
    Thnx
 * See below the code.
 *  function initialize() {
    if (GBrowserIsCompatible()) {
 *  // create the map
    map = new GMap2(document.getElementById(“map”)); <? $Lat 
   = 0.000000; $Lng = 0.000000; $query = “query deleted because of its length”;
 *  $db->query( $query );
    $db->getrow(); $stad_id = $db->field(0); $Lat = $db->
   field(1); $Lng = $db->field(2); ?> map.setCenter(new GLatLng( <? echo $Lng.”,”.
   $Lat ?>), 13); map.addControl(new GLargeMapControl3D()); map.addControl(new GMapTypeControl());
 *  // add the points
    <? $query = “query deleted because of its length”;
 *  $db->query( $query );
    while ( $db->getrow() ){ echo “point = new GLatLng(“.
   $db->field(1).”,”.$db->field(2).”);\n”; echo “marker = new createMarker(point,\””.
   $db->field(3).”\”,\”<b>”.$db->field(3).”</b>“.$db->field(4).” “.$db->field(5).”,“.
   $db->field(6).”\”);\n”; echo “map.addOverlay(marker);\n\n”; } ?> // put the assembled
   side_bar_html contents into the side_bar div document.getElementById(“side_bar”).
   innerHTML = side_bar_html; } else { alert(“Google Maps API is not compatible 
   with this browser”); } }

The topic ‘PHP code in javascript (google maps)’ is closed to new replies.

## Tags

 * [execute](https://wordpress.org/support/topic-tag/execute/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [rrijke](https://wordpress.org/support/users/rrijke/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/php-code-in-javascript-google-maps/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
