Load Google Markers using MYSQL
I've looked up other examples of this question on Stack, but they either use JQUERY or load using XML etc, which is NOT what I'm using to populate my Map.
Map works perfectly fine, but marker doesn't work when I attempt to reference a PHP variable as LatLng. I've tried to echo the LatLng Variable and use Heredocs but nothing works.
<? php
// I MADE QUERIES HERE AND ADDED THEM INTO "$coords"
echo<<<_
<!DOCTYPE html>
<html>
</style>
<body>
<div class="Banner">
<div class="TitleText">Sonic Strains ©</div>
</div>
<div class="login">Logout</div>
<div class="gallery" id="container">
<div class="map" id="mapInsert"></div>
<div class="navButton">Start Nav</div><div class="orderButton">Order Details</div>
<div class="abortButton">Abort</div><div class="confirmButton">Confirm</div><div class="disclaimer"></div>
</div>
<script>
function initMap() {
navigator.geolocation.getCurrentPosition(function(position) {
var initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var Map = new google.maps.Map(document.getElementById('mapInsert'));
Map.setCenter(initialLocation);
Map.setZoom(8);
}, function(positionError) {
//---------- User denied geolocation prompt - default to Chicago
Map.setCenter(new google.maps.LatLng(39.8097343, -98.5556199));
Map.setZoom(5);
},{enableHighAccuracy:true, timeout: 3000, maximumAge:1000});}
//MAKE ANOTHER MARKER FOR THE CLIENT LOCATION
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
marker.setMap(Map);}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[API_KEY]&callback=initMap"
async defer></script>
</body>
</html>
_;
?>
Error--
"SyntaxError: Unexpected token <"
This is where I try an reference the PHP LatLng Marker Position, why doesn't it allow me to reference PHP?
javascript php html5 google-maps mysqli
|
show 9 more comments
I've looked up other examples of this question on Stack, but they either use JQUERY or load using XML etc, which is NOT what I'm using to populate my Map.
Map works perfectly fine, but marker doesn't work when I attempt to reference a PHP variable as LatLng. I've tried to echo the LatLng Variable and use Heredocs but nothing works.
<? php
// I MADE QUERIES HERE AND ADDED THEM INTO "$coords"
echo<<<_
<!DOCTYPE html>
<html>
</style>
<body>
<div class="Banner">
<div class="TitleText">Sonic Strains ©</div>
</div>
<div class="login">Logout</div>
<div class="gallery" id="container">
<div class="map" id="mapInsert"></div>
<div class="navButton">Start Nav</div><div class="orderButton">Order Details</div>
<div class="abortButton">Abort</div><div class="confirmButton">Confirm</div><div class="disclaimer"></div>
</div>
<script>
function initMap() {
navigator.geolocation.getCurrentPosition(function(position) {
var initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var Map = new google.maps.Map(document.getElementById('mapInsert'));
Map.setCenter(initialLocation);
Map.setZoom(8);
}, function(positionError) {
//---------- User denied geolocation prompt - default to Chicago
Map.setCenter(new google.maps.LatLng(39.8097343, -98.5556199));
Map.setZoom(5);
},{enableHighAccuracy:true, timeout: 3000, maximumAge:1000});}
//MAKE ANOTHER MARKER FOR THE CLIENT LOCATION
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
marker.setMap(Map);}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[API_KEY]&callback=initMap"
async defer></script>
</body>
</html>
_;
?>
Error--
"SyntaxError: Unexpected token <"
This is where I try an reference the PHP LatLng Marker Position, why doesn't it allow me to reference PHP?
javascript php html5 google-maps mysqli
Need to let us know what line you are getting your syntax error, from just looking over it quickly I can see an error on line: var userLocation = {lat:<?php $coords[user_lat]?>, lng: <?php $coords[user_long]?>}; it should be var userLocation = {lat:<?php $coords['user_lat'];?>, lng: <?php $coords['user_long'];?>};
– Second2None
Jan 1 at 4:38
That's the line
– Sonic Strains
Jan 1 at 4:39
The Added '' & ; didn't make a difference, still getting the same error.
– Sonic Strains
Jan 1 at 4:42
Try <?php echo $coords[user_lat]; ?>
– user615274
Jan 1 at 4:44
I've stated in the original question that I've tried to echo but still get the same error.
– Sonic Strains
Jan 1 at 4:45
|
show 9 more comments
I've looked up other examples of this question on Stack, but they either use JQUERY or load using XML etc, which is NOT what I'm using to populate my Map.
Map works perfectly fine, but marker doesn't work when I attempt to reference a PHP variable as LatLng. I've tried to echo the LatLng Variable and use Heredocs but nothing works.
<? php
// I MADE QUERIES HERE AND ADDED THEM INTO "$coords"
echo<<<_
<!DOCTYPE html>
<html>
</style>
<body>
<div class="Banner">
<div class="TitleText">Sonic Strains ©</div>
</div>
<div class="login">Logout</div>
<div class="gallery" id="container">
<div class="map" id="mapInsert"></div>
<div class="navButton">Start Nav</div><div class="orderButton">Order Details</div>
<div class="abortButton">Abort</div><div class="confirmButton">Confirm</div><div class="disclaimer"></div>
</div>
<script>
function initMap() {
navigator.geolocation.getCurrentPosition(function(position) {
var initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var Map = new google.maps.Map(document.getElementById('mapInsert'));
Map.setCenter(initialLocation);
Map.setZoom(8);
}, function(positionError) {
//---------- User denied geolocation prompt - default to Chicago
Map.setCenter(new google.maps.LatLng(39.8097343, -98.5556199));
Map.setZoom(5);
},{enableHighAccuracy:true, timeout: 3000, maximumAge:1000});}
//MAKE ANOTHER MARKER FOR THE CLIENT LOCATION
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
marker.setMap(Map);}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[API_KEY]&callback=initMap"
async defer></script>
</body>
</html>
_;
?>
Error--
"SyntaxError: Unexpected token <"
This is where I try an reference the PHP LatLng Marker Position, why doesn't it allow me to reference PHP?
javascript php html5 google-maps mysqli
I've looked up other examples of this question on Stack, but they either use JQUERY or load using XML etc, which is NOT what I'm using to populate my Map.
Map works perfectly fine, but marker doesn't work when I attempt to reference a PHP variable as LatLng. I've tried to echo the LatLng Variable and use Heredocs but nothing works.
<? php
// I MADE QUERIES HERE AND ADDED THEM INTO "$coords"
echo<<<_
<!DOCTYPE html>
<html>
</style>
<body>
<div class="Banner">
<div class="TitleText">Sonic Strains ©</div>
</div>
<div class="login">Logout</div>
<div class="gallery" id="container">
<div class="map" id="mapInsert"></div>
<div class="navButton">Start Nav</div><div class="orderButton">Order Details</div>
<div class="abortButton">Abort</div><div class="confirmButton">Confirm</div><div class="disclaimer"></div>
</div>
<script>
function initMap() {
navigator.geolocation.getCurrentPosition(function(position) {
var initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var Map = new google.maps.Map(document.getElementById('mapInsert'));
Map.setCenter(initialLocation);
Map.setZoom(8);
}, function(positionError) {
//---------- User denied geolocation prompt - default to Chicago
Map.setCenter(new google.maps.LatLng(39.8097343, -98.5556199));
Map.setZoom(5);
},{enableHighAccuracy:true, timeout: 3000, maximumAge:1000});}
//MAKE ANOTHER MARKER FOR THE CLIENT LOCATION
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
marker.setMap(Map);}
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[API_KEY]&callback=initMap"
async defer></script>
</body>
</html>
_;
?>
Error--
"SyntaxError: Unexpected token <"
This is where I try an reference the PHP LatLng Marker Position, why doesn't it allow me to reference PHP?
javascript php html5 google-maps mysqli
javascript php html5 google-maps mysqli
edited Jan 1 at 14:26
Sonic Strains
asked Jan 1 at 4:31
Sonic StrainsSonic Strains
216
216
Need to let us know what line you are getting your syntax error, from just looking over it quickly I can see an error on line: var userLocation = {lat:<?php $coords[user_lat]?>, lng: <?php $coords[user_long]?>}; it should be var userLocation = {lat:<?php $coords['user_lat'];?>, lng: <?php $coords['user_long'];?>};
– Second2None
Jan 1 at 4:38
That's the line
– Sonic Strains
Jan 1 at 4:39
The Added '' & ; didn't make a difference, still getting the same error.
– Sonic Strains
Jan 1 at 4:42
Try <?php echo $coords[user_lat]; ?>
– user615274
Jan 1 at 4:44
I've stated in the original question that I've tried to echo but still get the same error.
– Sonic Strains
Jan 1 at 4:45
|
show 9 more comments
Need to let us know what line you are getting your syntax error, from just looking over it quickly I can see an error on line: var userLocation = {lat:<?php $coords[user_lat]?>, lng: <?php $coords[user_long]?>}; it should be var userLocation = {lat:<?php $coords['user_lat'];?>, lng: <?php $coords['user_long'];?>};
– Second2None
Jan 1 at 4:38
That's the line
– Sonic Strains
Jan 1 at 4:39
The Added '' & ; didn't make a difference, still getting the same error.
– Sonic Strains
Jan 1 at 4:42
Try <?php echo $coords[user_lat]; ?>
– user615274
Jan 1 at 4:44
I've stated in the original question that I've tried to echo but still get the same error.
– Sonic Strains
Jan 1 at 4:45
Need to let us know what line you are getting your syntax error, from just looking over it quickly I can see an error on line: var userLocation = {lat:<?php $coords[user_lat]?>, lng: <?php $coords[user_long]?>}; it should be var userLocation = {lat:<?php $coords['user_lat'];?>, lng: <?php $coords['user_long'];?>};
– Second2None
Jan 1 at 4:38
Need to let us know what line you are getting your syntax error, from just looking over it quickly I can see an error on line: var userLocation = {lat:<?php $coords[user_lat]?>, lng: <?php $coords[user_long]?>}; it should be var userLocation = {lat:<?php $coords['user_lat'];?>, lng: <?php $coords['user_long'];?>};
– Second2None
Jan 1 at 4:38
That's the line
– Sonic Strains
Jan 1 at 4:39
That's the line
– Sonic Strains
Jan 1 at 4:39
The Added '' & ; didn't make a difference, still getting the same error.
– Sonic Strains
Jan 1 at 4:42
The Added '' & ; didn't make a difference, still getting the same error.
– Sonic Strains
Jan 1 at 4:42
Try <?php echo $coords[user_lat]; ?>
– user615274
Jan 1 at 4:44
Try <?php echo $coords[user_lat]; ?>
– user615274
Jan 1 at 4:44
I've stated in the original question that I've tried to echo but still get the same error.
– Sonic Strains
Jan 1 at 4:45
I've stated in the original question that I've tried to echo but still get the same error.
– Sonic Strains
Jan 1 at 4:45
|
show 9 more comments
2 Answers
2
active
oldest
votes
The problem are the opening tag. You're using an invalid tag:
<? php
(note the blank between question and PHP keyword).
You need to change it to a correct opening PHP tag, as:
<?php
Also, on the code, you need to echo the vars, because you're not doing anything with it.
var userLocation = {lat:<?php echo $coords[user_lat]; ?>, lng: <?php echo $coords[user_long]; ?>};
((EDIT))
Ok, doing a new revision to the code, I can see at least one problem:
You're creating a POI with this syntax:
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
Checking on my own code, there's a functional poi adding code:
newmarker = new google.maps.Marker({
map: map,
key: marker[0],
name: marker[1],
lat: marker[3],
lon: marker[4],
content: marker[9],
position: new google.maps.LatLng(marker[3], marker[4]),
icon: icon
});
Probably, lot of the code (key, name, etc) are optional values, but, you're adding an array to position value, and not a LatLng value.
If that code doesn't work, please check your HTML code directly (not on PHP), because you can have something strange on the code blocking the loading process (For example, php is not filling the values correctly).
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
|
show 6 more comments
The issue was that the marker declaration was outside of the initMap(). When I moved the marker inside of the Main Function it worked
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993023%2fload-google-markers-using-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem are the opening tag. You're using an invalid tag:
<? php
(note the blank between question and PHP keyword).
You need to change it to a correct opening PHP tag, as:
<?php
Also, on the code, you need to echo the vars, because you're not doing anything with it.
var userLocation = {lat:<?php echo $coords[user_lat]; ?>, lng: <?php echo $coords[user_long]; ?>};
((EDIT))
Ok, doing a new revision to the code, I can see at least one problem:
You're creating a POI with this syntax:
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
Checking on my own code, there's a functional poi adding code:
newmarker = new google.maps.Marker({
map: map,
key: marker[0],
name: marker[1],
lat: marker[3],
lon: marker[4],
content: marker[9],
position: new google.maps.LatLng(marker[3], marker[4]),
icon: icon
});
Probably, lot of the code (key, name, etc) are optional values, but, you're adding an array to position value, and not a LatLng value.
If that code doesn't work, please check your HTML code directly (not on PHP), because you can have something strange on the code blocking the loading process (For example, php is not filling the values correctly).
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
|
show 6 more comments
The problem are the opening tag. You're using an invalid tag:
<? php
(note the blank between question and PHP keyword).
You need to change it to a correct opening PHP tag, as:
<?php
Also, on the code, you need to echo the vars, because you're not doing anything with it.
var userLocation = {lat:<?php echo $coords[user_lat]; ?>, lng: <?php echo $coords[user_long]; ?>};
((EDIT))
Ok, doing a new revision to the code, I can see at least one problem:
You're creating a POI with this syntax:
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
Checking on my own code, there's a functional poi adding code:
newmarker = new google.maps.Marker({
map: map,
key: marker[0],
name: marker[1],
lat: marker[3],
lon: marker[4],
content: marker[9],
position: new google.maps.LatLng(marker[3], marker[4]),
icon: icon
});
Probably, lot of the code (key, name, etc) are optional values, but, you're adding an array to position value, and not a LatLng value.
If that code doesn't work, please check your HTML code directly (not on PHP), because you can have something strange on the code blocking the loading process (For example, php is not filling the values correctly).
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
|
show 6 more comments
The problem are the opening tag. You're using an invalid tag:
<? php
(note the blank between question and PHP keyword).
You need to change it to a correct opening PHP tag, as:
<?php
Also, on the code, you need to echo the vars, because you're not doing anything with it.
var userLocation = {lat:<?php echo $coords[user_lat]; ?>, lng: <?php echo $coords[user_long]; ?>};
((EDIT))
Ok, doing a new revision to the code, I can see at least one problem:
You're creating a POI with this syntax:
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
Checking on my own code, there's a functional poi adding code:
newmarker = new google.maps.Marker({
map: map,
key: marker[0],
name: marker[1],
lat: marker[3],
lon: marker[4],
content: marker[9],
position: new google.maps.LatLng(marker[3], marker[4]),
icon: icon
});
Probably, lot of the code (key, name, etc) are optional values, but, you're adding an array to position value, and not a LatLng value.
If that code doesn't work, please check your HTML code directly (not on PHP), because you can have something strange on the code blocking the loading process (For example, php is not filling the values correctly).
The problem are the opening tag. You're using an invalid tag:
<? php
(note the blank between question and PHP keyword).
You need to change it to a correct opening PHP tag, as:
<?php
Also, on the code, you need to echo the vars, because you're not doing anything with it.
var userLocation = {lat:<?php echo $coords[user_lat]; ?>, lng: <?php echo $coords[user_long]; ?>};
((EDIT))
Ok, doing a new revision to the code, I can see at least one problem:
You're creating a POI with this syntax:
var userLocation = {lat:$coords[user_lat], lng:$coords[user_long]};
var marker = new google.maps.Marker({
position:userLocation,
map:Map,
draggable:false,
clickable:false
});
Checking on my own code, there's a functional poi adding code:
newmarker = new google.maps.Marker({
map: map,
key: marker[0],
name: marker[1],
lat: marker[3],
lon: marker[4],
content: marker[9],
position: new google.maps.LatLng(marker[3], marker[4]),
icon: icon
});
Probably, lot of the code (key, name, etc) are optional values, but, you're adding an array to position value, and not a LatLng value.
If that code doesn't work, please check your HTML code directly (not on PHP), because you can have something strange on the code blocking the loading process (For example, php is not filling the values correctly).
edited Jan 1 at 18:36
answered Jan 1 at 5:08
Sakura KinomotoSakura Kinomoto
1,0111122
1,0111122
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
|
show 6 more comments
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
This is super frustrating because I've tried to echo the code many times, but get the same result. Can any1 try and run a simple query and reference it inline?
– Sonic Strains
Jan 1 at 5:16
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
Did you try to fix your shorttag opening? I have a webpage when I define variables on PHP and I use it on javascript using a <script> and var=<?php echo $phpVar; ?> working without problem.
– Sakura Kinomoto
Jan 1 at 5:19
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
The tags are cleaned up and the Local Server is running.
– Sonic Strains
Jan 1 at 5:21
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
SyntaxError are from PHP or from JavaScript?? Also, if you want you can come to SO chat on PHP channel to try to view it on a more detail maybe...
– Sakura Kinomoto
Jan 1 at 5:28
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
Forget it about chat. You need more reputation for doing it. I really didn't see anything bad on your code for not work echoing a variable. The only option I think who can be are a error on the code not posted here. It's because this I've told you for check PHP error log... Also, check HTML code on client-side for if it's here anything strange (for example something before the <HTML> tag). If you find something, please edit your question to complete the information.
– Sakura Kinomoto
Jan 1 at 5:40
|
show 6 more comments
The issue was that the marker declaration was outside of the initMap(). When I moved the marker inside of the Main Function it worked
add a comment |
The issue was that the marker declaration was outside of the initMap(). When I moved the marker inside of the Main Function it worked
add a comment |
The issue was that the marker declaration was outside of the initMap(). When I moved the marker inside of the Main Function it worked
The issue was that the marker declaration was outside of the initMap(). When I moved the marker inside of the Main Function it worked
edited Jan 2 at 18:01
answered Jan 1 at 19:25
Sonic StrainsSonic Strains
216
216
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993023%2fload-google-markers-using-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Need to let us know what line you are getting your syntax error, from just looking over it quickly I can see an error on line: var userLocation = {lat:<?php $coords[user_lat]?>, lng: <?php $coords[user_long]?>}; it should be var userLocation = {lat:<?php $coords['user_lat'];?>, lng: <?php $coords['user_long'];?>};
– Second2None
Jan 1 at 4:38
That's the line
– Sonic Strains
Jan 1 at 4:39
The Added '' & ; didn't make a difference, still getting the same error.
– Sonic Strains
Jan 1 at 4:42
Try <?php echo $coords[user_lat]; ?>
– user615274
Jan 1 at 4:44
I've stated in the original question that I've tried to echo but still get the same error.
– Sonic Strains
Jan 1 at 4:45