Using MySQL to place custom markers

22 views
Skip to first unread message

Rob Lischer

unread,
May 28, 2017, 7:32:07 PM5/28/17
to Google Maps JavaScript API v3
I have a MySQL database set up that places markers just fine, now I want to pull the marker icon from the same database so I can display any marker I create for each record.

Does anyone know how to do this within the php code below?  For example I will have an "icon" field with a "some_random_icon.png" in it and I will create icons for every record that the php code loops through.



     <?php

     $query = mysqli_query($conn, "SELECT * FROM mytable")or die(mysql_error());
     
         while($row = mysqli_fetch_array($query))
    {
      $logo = $row['logo'];
      $company = $row['company'];
      $lat = $row['lat'];
      $lon = $row['lon'];
      $desc = $row['desc'];

 
   echo("addMarker($lat, $lon, '<b>$logo</b><b>$company<br />$desc');\n");
      
   }
  ?>

Thanks!

Reply all
Reply to author
Forward
0 new messages