Using php and mysql with jquery bMap -


for university project creating website helps find golf courses around ireland & n.ireland. have done using bmap - jquery , google maps. can choose county sidebar , shown on map. have used following code this:

$(document).ready(function(){      $("#map").bmap({         mapzoom: 8,         mapcenter:[53.65115,    -8.81104],         mapsidebar:"sidebar", //id of div use sidebar         markers:{"data":[                 {"lat":"54.66625","lng":"-6.28647","title":"county antrim","rnd":"1","body":"there 38 golf clubs in county antrim, <a href='counties/antrim.html'>view here</a>"},                  {"lat":"54.29401","lng":"-6.66592","title":"county armagh","rnd":"1","body":"there 8 golf clubs in county armagh, <a href='counties/armagh.html'>view here</a>"}, 

what wondering there way can create database , use php/mysql show same results. need county antrim, county armagh, etc.

thanks in advance help.

store courses in database columns required such latitude, longitude, title, rnd, body. build string them, , reference in javascript code.

$course_data = ""; $sql = "select * golf_courses"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) {     $course_data .= '{"lat":"' . $row['latitude'] . '","lng":"' . $row['longitude'] . '","title":"' . $row['title'] . '","rnd":"' . $row['rnd'] . '","body":"' . $row['body'] . '"},' } 

and in code, reference course_data variable, example:

$(document).ready(function(){      $("#map").bmap({         mapzoom: 8,         mapcenter:[53.65115,    -8.81104],         mapsidebar:"sidebar", //id of div use sidebar         markers:{"data":[                 <?php echo $course_data; ?> 

remember example , need playing around database tables right etc.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -