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:
{"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" }
]}
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:
Representing event 1 10:00-12:00
Representing event 2 - 15:00-16:00
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???:
$return_arr = array();
$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());
while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
$row_array['latitude'] = $row['latitude'];
$row_array['longitude'] = $row['longitude'];
$row_array['content'] = "<b>".$row['title']."</b><br/>".$row['event'];
array_push($return_arr,$row_array);
}
echo '{"markers":'.json_encode($return_arr).'}';
What I would like is something like this, one record:
"latitude":57.7973333, "longitude":12.0502107, "content":"Representing event 1 10:00-12:00 Representing event 2 - 15:00-16:00"
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