$i = 0;
while($row=mysql_fetch_array($result)){
echo "locations[" .$i++ ."] = [" .$row['Latitude'] ."," .$row['Longitude'] ."];";
}
?>
for(i=0; i< locations.length; i++){
var marker = new naver.maps.Marker({
position: new naver.maps.LatLng(locations[i][0],locations[i][1]), map: map
});
}
The sauce looks like a stomach.
At that part
locations[i][0], locations[i][1] This is how the code goes...
If it's 100, I have to write down all 100. locations[i][i] I can't do it like this. Too simple a thought
I guess so I want to write it in one line so that I can call up several. Help me
jquery java
What does it mean to write in one line...?
However, I think it would be good to write the data generation part in JSON as follows.
locations = [ [36.123,123.00], [31.04,126.01], .... ];
To do the above, change the code of the php part as follows.
// omit the front part
echo "locations=[";
$i=0;
while($row=mysql_fetch_array($result)){
If($i++>0) echo ""; // from the second entry, prepend , .
echo "[" . $row['Latitude'] . "," . $row['Longitude'] . "]";
}
echo "];";
?>
887 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
610 Uncaught (inpromise) Error on Electron: An object could not be cloned
577 PHP ssh2_scp_send fails to send files as intended
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.