So i'm making a google embedded page where i need some pinpoints declared. I want to store these in a database and get them the way you'd also fill a table with php.
My code should produce this:
['Street', coordinates, coordinates, ID],
['Street', coordinates, coordinates, ID],
['Street', coordinates, coordinates, ID],
['Street', coordinates, coordinates, ID]
etc.
Right now i got this:
<script type="text/javascript">
var locations = [
<?php while ($row2 = mysqli_fetch_array($result2)) {
echo '[' . $row2['Straat'] . ',' . $row2['Noorderbreedte'] . ',' . $row2['Westerlengte'] . ',' . $row2['ID'] . '],';
}
?>
Can't workout how this should work or if there is an easier way to just get database objects via JS.
json_encode()to transform php array to JS array