Note that there are some explanatory texts on larger screens.

plurals
  1. POgoogle maps jquery plugin with json, php, mysql overwritten markers
    primarykey
    data
    text
    <p>I am using jquery plugin to for google maps, trough json I am getting GPS coordinates and infos for the events. The problem is when I have 2 same markers (GPS coordinates are the same) but info of event is different, for example:</p> <p><code>{"markers":[ { "latitude":57.7973333, "longitude":12.0502107, "content":"Representing event 1 10:00-12:00" }, { "latitude":57.7973333, "longitude":12.0502107, "content":"Representing event 2 - 15:00-16:00" } ]}</code></p> <p>The problem is that markers are overwritten, I get info only for one event on one position, and not 2 events, how could I get one 1 marker with all the infos on the map, something like 1 marker with one info box where I would have this info:</p> <p>Representing event 1 10:00-12:00</p> <p>Representing event 2 - 15:00-16:00</p> <p>My code is like that now - i think this could be done with mysql but not really sure how, is there a way to check the gps coordinates and if there same take all content and store in one field???:</p> <p><code>$return_arr = array();</code></p> <p><code>$fetch = mysql_query("SELECT title,event,SUBSTRING_INDEX(gps,',',1) as latitude,SUBSTRING_INDEX(gps,',',-1) as longitude,gps FROM termin,event WHERE gps IS NOT NULL AND gps!='' AND event_id_fk=event_id") or die(mysql_error());</code> </p> <p><code>while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) { $row_array['latitude'] = $row['latitude']; $row_array['longitude'] = $row['longitude']; $row_array['content'] = "&lt;b&gt;".$row['title']."&lt;/b&gt;&lt;br/&gt;".$row['event'];</code></p> <pre><code>array_push($return_arr,$row_array); </code></pre> <p><code>}</code></p> <p><code>echo '{"markers":'.json_encode($return_arr).'}';</code></p> <p>What I would like is something like this, one record: </p> <p>"latitude":57.7973333, "longitude":12.0502107, "content":"Representing event 1 10:00-12:00 Representing event 2 - 15:00-16:00" </p> <p>or is there some other way to check it with loop? that would be better I think, because than I would be able to use html for every event</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload