Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
October 2, 2006, 4:15 am
rate this thread
test...what I have is an index.html page that refers to "map_data.php"
map_data.php draws some coordinates from a database and outputs them
into an array called markers. However, when I load up the index.html
page, it says "markers" is undefined...
Here's the code in map_data.php:
var markers = [
<?php while($row = mysql_fetch_assoc($result)): ?>
<?= $joiner ?>
'latitude': <?= $row['latitude'] ?>,
'longitude': <?= $row['longitude'] ?>,
'lawyer': <?= $row['lawyer']?>,
'city': <?= $row['city']?>,
'business_name': '<?= addslashes($row['business_name'])?>',
'address': '<?= addslashes($row['address'])?>'
$joiner = ',';
<?php endwhile; ?>
I can't get anything in the map_functions.js to read this markers
array, even if it's a simple alert call like
Tried viewing the source? It would be very helpful if you could show what
php actually outputs there. Since markers is undefined, are you sure you've
<?php require(map_data.php ?>
And I just gotta say... You're actually using while(): endwhile! Burn the
witch! Vade retro satana! (Nothing wrong with the syntax though, it IS valid
php, but man, it's just unorthodox!)
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pivittyv nettisarjis
firstname.lastname@example.org || Gedoon-S @ IRCnet || rot13(email@example.com)
I suspect you have short tags disabled in your php.ini file.
Instead of '<?= ' you should use '<?php echo '.
Remove the "x" from my email address
JDS Computer Training Corp.