Welcome Guest, Not a member yet? Register   Sign In
Show locations using Leaflet, array ?

(This post was last modified: 04-07-2020, 01:32 AM by kelapamuda.)

I try to show location on map using Leaflet from Lat and Long from my database, its OK the map is already shown up,  but only show one location, not all from database. Is there any error on my array or loop?
function show_map($people_id) {
               $config = array(
               'center'         => '4.637120, 96.842534', // Center of the map
               'zoom'           => 6, // Map zoom
                $result = $this->db->query("SELECT * FROM table_location   ");
                foreach ($result->result_array() as $data)

                      $marker = array();
        $marker['position'] = ''.$lat.','.$lon.'';
                   $data['map'] =  $this->leaflet->create_map();             
                   $this->load->view('view_maps', $data);  



Have you tested the query to make sure that it is pulling more than 1 location?

Theme © iAndrew 2016 - Forum software by © MyBB