Hi im relatively new to PHP and very new to google maps API but I would like to retrieve data from my mysql database and post it onto my google map, the problem is that I need to search database A for relevant data, pull an 'id' from each entry then search database B for all the ids pulled and finally use the data pulled from database B to place a marker on a google map (database B holds the 'id' to correspond with database A a latitude field and a longitude field). I hope all this makes sense after reading my code:
<?PHP
$min = $_POST['min'];
$result = mysqli_query($con,"SELECT * FROM A WHERE x>".$min);
while($row = mysqli_fetch_array($result))
{
$host=$row['host_id'];
$result1 = mysqli_query($con,"SELECT * FROM B WHERE host_id=".$host);
while($row1 = mysqli_fetch_array($result1));
{
$lat2=$row1['latitude'];
$lon2=$row1['longitude'];
echo 'var myLatLng = new google.maps.LatLng('.$lat2.','.$lon2.');';
echo 'var aMarker = new google.maps.Marker({';
echo 'position: myLatLng,';
echo 'map: map,';
echo '});';
}
}
?>
As I said im pretty new to PHP so any help as to where im going wrong here would be greatly appreciated Thanks :)