i have an sql with 2 columns, latitude and longitude.
I am able to print out the entries of these two columns like:
$result = mysqli_query($con,"SELECT * FROM events");
while ($row = mysqli_fetch_array($result)) {
echo $row['latitude'];
echo $row['longitude'];
}
I also have a JS function, where i need a while to add as many JS lines as the sql query returns. Here is the JS:
var myMarkers = {"markers": [
{"latitude": "47.47256859162068", "longitude":"19.055979251861572", "icon": "marker.png", "baloon_text": 'This is <strong>Budapest</strong>'},
]
};
So i'd need something like: "latitude": $latitude[i] and "longitude": $longitude[i] all these in a for or a while
Is there a way that i could pass the content of the two sql rows to a js function, to be able to get all the line with the correct values?
ballon_textcome from? Is it in the same database as lat long?