close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

PHP/MySQL errors in wagmp_map file

Thread began 12/04/2009 7:57 am by millerb395386 | Last modified 12/07/2009 3:37 pm by Jason Byrnes | 3468 views | 14 replies |

millerb395386

PHP/MySQL errors in wagmp_map file

Hello all,

I was able to successfully create a dynamic map on the first go. I went back to add content to the custom display and now I've managed to break things. I completely ripped out the old code and includes inserted by Pro Maps and started over but I am unable to get past this error in the inserted code.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/rmgoorg/bryantest/merchant/google_javascript/wagmp_map_1.php on line 261

Warning: mysql_data_seek(): supplied argument is not a valid MySQL result resource in /home/rmgoorg/bryantest/merchant/google_javascript/wagmp_map_1.php on line 262

The site is map_view.php

Cheers

Sign in to reply to this post

Jason ByrnesWebAssist

It looks like 2 of the the map script tags are added in the wrong place. They should be added to the page just before </head> tag, but it looks they are on the page before the <doctype> tag.

If you are having trouble spotting the problem, please send a copy of the map_view.php page so I can examine the code.

Sign in to reply to this post

millerb395386

Originally Said By: Jason Byrnes
  It looks like 2 of the the map script tags are added in the wrong place. They should be added to the page just before </head> tag, but it looks they are on the page before the <doctype> tag.

If you are having trouble spotting the problem, please send a copy of the map_view.php page so I can examine the code.  



Yes, I noticed that. That was one primary difference between the first (successful) run and subsequent (failed) runs. Whoever developed the site did many naughty things such as closing open tags inside SSI includes, etc. I wonder if that is what is throwing things off.

I will move the script tags and see what happens.

Sign in to reply to this post

millerb395386

Thanks Jason!

I was able to get it working by moving the script tags as you mentioned. They were way off.

Two other items. I am not able to get the the business_address field to show up in the info window even though I have a custom window as follows (and business_name is in the record set):

<strong>Merchant:</strong>
<?php echo $row_Google_Recordset['business_name']; ?>
<?php echo $row_Google_recordset['business_address']; ?>
<?php echo $row_Google_recordset['city']; ?>,
<?php echo $row_Google_recordset['state']; ?>
<?php echo $row_Google_recordset['zip']; ?>

The business_name never shows up in the window.

Sign in to reply to this post

Jason ByrnesWebAssist

Please send a copy of your google_javascript/wagmp_map_1.php fil so I can look at the code.

Sign in to reply to this post

millerb395386

Do you prefer email or shall I post it here?

Sign in to reply to this post

millerb395386

Note: I removed function definitions in the prologue as the snippet was too long for the forum.

function wagmp_map_1() {
if(GBrowserIsCompatible()) {
if(!document.getElementById('wagmp_map_1')) return false;
var map = new GMap2(document.getElementById('wagmp_map_1'));
wagmp_map_1_obj = new WAMapRef(map);
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.addControl(new GSmallMapControl());
var geocoder = new GClientGeocoder();

var fromAddress = {
enabled: false,
street: '',
city: '',
state: '',
zip: '',
country: '',
full: ''
};

var icon_0 = new GIcon();
icon_0.image = 'plugins/google_javascript/images/traditionalflat_pacifica.png';
icon_0.shadow = 'google_javascript/images/traditionalflat_shadow.png';
icon_0.iconSize = new GSize(34,35);
icon_0.shadowSize = new GSize(34,35);
icon_0.iconAnchor = new GPoint(9,33);
icon_0.infoWindowAnchor = new GPoint(19,0);
icon_0.printImage = 'plugins/google_javascript/images/traditionalflat_pacifica.gif';
icon_0.mozPrintImage = 'plugins/google_javascript/images/traditionalflat_pacifica_mozprint.png';
icon_0.printShadow = 'google_javascript/images/traditionalflat_shadow.gif';
icon_0.transparent = 'google_javascript/images/traditionalflat_pacifica_transparent.png';

<?php $Google_recordset_id = 0; ?>
<?php do { ?>
var address_0_<?php echo $Google_recordset_id; ?> = {
street: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['business_address'] .""); ?>',
city: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['city'] .""); ?>',
state: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['state'] .""); ?>',
zip: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['zip'] .""); ?>',
country: '',
infowindow: 'custom',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color: black;"><?php echo str_replace("'", "\'", "<strong>Reported Merchant:</strong><br />".$row_Google_Recordset['business_name'] ."<br />".$row_Google_recordset['business_address'] ."<br />".$row_Google_recordset['city'] .", ".$row_Google_recordset['state'] ." ".$row_Google_recordset['zip'] .""); ?></span>',
full: '<?php echo str_replace("'", "\'", "".$row_Google_recordset['business_address'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['city'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['state'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Google_recordset['zip'] .""); ?>',
isdefault: true,
addressType: 'address',
loop: 'Google_recordset',
latitude: '',
longitude: '',
markerStyle: 'Google Traditional (flat)',
markerColor: 'Pacifica'
};

if (address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates") {
var cacheReturn = '';
} else {
var cacheReturn = searchCache(address_0_<?php echo $Google_recordset_id; ?>.full, address_0_<?php echo $Google_recordset_id; ?>.zip);
}
if (cacheReturn != "" || (address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates")) {
if(address_0_<?php echo $Google_recordset_id; ?>.addressType == "coordinates") {
var latitude = address_0_<?php echo $Google_recordset_id; ?>.latitude;
var longitude = address_0_<?php echo $Google_recordset_id; ?>.longitude;
} else {
var latitude = cacheReturn.substring(1,cacheReturn.indexOf(",")-1);
var longitude = cacheReturn.substring(cacheReturn.indexOf(",")+1,(cacheReturn.length)-1);
}
var point = new GLatLng(latitude, longitude);
if (point && !isNaN(latitude)) {
wagmp_map_1_obj.addressFailed = false;
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
map.setZoom(12);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);
} else {
if (wagmp_map_1_obj.addressFailed) {
map.setCenter(new GLatLng(30, -98), 3);
}
wagmp_map_1_obj.addressFailed = true;
}
} else if (address_0_<?php echo $Google_recordset_id; ?>.addressType == "address") {
geocoder.getLatLng (
address_0_<?php echo $Google_recordset_id; ?>.full,
function(point) {
if(point) {
this.addressFailed = false;
addToCache(address_0_<?php echo $Google_recordset_id; ?>.full, '', point);
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if(!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);

} else {
var noZipAddress = address_0_<?php echo $Google_recordset_id; ?>.full.replace((address_0_<?php echo $Google_recordset_id; ?>.zip+','), '');
geocoder.getLatLng (noZipAddress,
function(point) {
if(point) {
wagmp_map_1_obj.addressFailed = false;
addToCache(address_0_<?php echo $Google_recordset_id; ?>.full, address_0_<?php echo $Google_recordset_id; ?>.zip, point);
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
GEvent.addListener(marker_0_<?php echo $Google_recordset_id; ?>, 'click', function() {
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
});
if (!fromAddress.enabled || 'address_0_<?php echo $Google_recordset_id; ?>' != 'address_0_0') {
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
map.setCenter(point, 13);
map.addOverlay(marker_0_<?php echo $Google_recordset_id; ?>);
if('address_0_<?php echo $Google_recordset_id; ?>' == 'address_0_0')
marker_0_<?php echo $Google_recordset_id; ?>.openInfoWindowHtml(address_0_<?php echo $Google_recordset_id; ?>.infowindowtext);
}
wagmp_map_1_obj.markers.push(marker_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.addresses.push(address_0_<?php echo $Google_recordset_id; ?>);
wagmp_map_1_obj.icons.push(icon_0);
wagmp_map_1_obj.points.push(point);

} else {
if (wagmp_map_1_obj.addressFailed) {
map.setCenter(new GLatLng(30, -98), 3);
}
wagmp_map_1_obj.addressFailed = true;
}
}
);
}
}
);
}
<?php $Google_recordset_id++; ?>
<?php } while ($row_Google_recordset = mysql_fetch_assoc($Google_recordset)); ?>
<?php mysql_data_seek($Google_recordset, 0); ?>


}
}

Sign in to reply to this post

Jason ByrnesWebAssist

I do not see any problem in the code, can you double check in the database that the business_name column has a value. It would seem this column is empty in the Database.

Sign in to reply to this post

millerb395386

When I test the recordset using the "Test Connection" button in Dreamweaver it clearly shows values for the business_name field. Also, browsing the MySQL database shows them to be there as well.

Sign in to reply to this post

millerb395386

I think I see the problem. Google_recordset for business_name has a capital "R" on recordset. I'll re-run and see what happens.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...