Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:37:42+00:00 2026-06-18T12:37:42+00:00

I need to display markers from database using PHP codeigniter I will not get

  • 0

I need to display markers from database using PHP codeigniter
I will not get map

function initialize() {
    var myLatLng = new google.maps.LatLng(18.5236, 73.8478);
    var mapOptions = {
        zoom: 14,
        center: myLatLng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

    // Add 5 markers to the map at random locations.
    var southWest = new google.maps.LatLng(18.5236,73.8478);
    var northEast = new google.maps.LatLng(19.5236,75.8478);

    var bounds = new google.maps.LatLngBounds(southWest,northEast);
    map.fitBounds(bounds);
    var lngSpan = northEast.lng() - southWest.lng();
    var latSpan = northEast.lat() - southWest.lat();


//If I comment below line it show blank map

    beaches =  [ <?php foreach($records as $row) echo "[".$row->property_title.', '.$row->property_latitude.', '.$row->property_longitude.'],'?>]"

    for (var i = 0; i < beaches.length; i++) {
          var beach = beaches[i];
          var myLatLng = new google.maps.LatLng(beach[1], beach[2]);
          var marker = new google.maps.Marker({
              position: myLatLng,
              map: map,
              title: beach[0]            
          });           
      }                                           
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:37:44+00:00Added an answer on June 18, 2026 at 12:37 pm

    If $row->property_title is a string, it needs to between quotes:

    echo "['".$row->property_title."', ".$row->property_latitude.', '.$row->property_longitude.'],'?>]"
    

    Alternatively, you could use json_encode to output your array:

    <?php
    $beaches = array();
    foreach ($records as $row) {$beaches[] = array($row->property_title, $row->property_latitude, $row->property_longitude);}
    echo 'beaches = ' . json_encode($beaches) . ';';
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display markers with information on a slippy map using OpenLayers. An
I need to display multiple markers on a map, each with their own infowindow.
I have a map view with markers on it. I need do display a
I need to display a set of markers on a google map. In addition,
I am trying to get some json markers to display on my map. The
i am developing one application with map view i need display the weather depends
I need to display the parent from the first Element of input.xml Also I
I am using google maps api to display some points on a map. I
I need to display many markers on a WPF image. The markers can be
I'm using Google Maps to display a lot of markers. Too many, in fact.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.