ArnMan
09-17-2011, 04:26 AM
hello,
I have spent nearly the past week scouring the net, looking for a solution. I am needing to query mysql with php, with gives me a array of information.
And I need to feed, this info into my javascript google maps api
now before you say anything, my google map is working, i just want to add multiple markers.
And the line I believe that needs to be changed, is just a plain javascript.
first i wil start off and show my mysql query.
$cityl=mysql_query("SELECT * FROM citylocation WHERE citylong < {$ir['userlongitute']}+5 AND citylong > {$ir['userlongitute']}-5 AND citylat > {$ir['userlatitude']}-5 AND citylat < {$ir['userlatitude']}+5 ");
$cityarray = mysql_fetch_array( $cityl);
the npclocation table has the following fields w/descriptions
citylocid - autoincrement
cityid - id for cities
citylname - name for the cities
citylong - longitude for cities
citylat - latitude for cities
inside the javascript I have
var newpoints = new Array();
and here is the function inside the javascript
function addPoints() {
newpoints[0] = new Array(51.45400691005981, -2.63671875, icon0, 'bristol', 'bristol');
newpoints[1] = new Array(53.30462107510271, -6.1962890625, icon0, 'dublin', 'dublin');
newpoints[2] = new Array(30.031055426540206, -90, icon0, 'New Orleans', 'New Orleans');
for(var i = 0; i < newpoints.length; i++) {
var point = new GPoint(newpoints[i][1],newpoints[i][0]);
var popuphtml = newpoints[i][4] ;
var marker = createMarker(point,newpoints[i][2],popuphtml);
map.addOverlay(marker);
}
}
As you can see there are numerous newpoints[somenumber] and array info.
I dont want to have to have lines like that, i want to integrate the table fields array into the line and then i guess looped through until the end of the line.
to something like
newpoints[?] = new Array(citylong, citylat, icon0, 'citylname', 'citylname');
or something like that
I am terrible at js skills
my php skills could be better, but I can get the job done in php.
Any help would be great appreciated.
I have spent nearly the past week scouring the net, looking for a solution. I am needing to query mysql with php, with gives me a array of information.
And I need to feed, this info into my javascript google maps api
now before you say anything, my google map is working, i just want to add multiple markers.
And the line I believe that needs to be changed, is just a plain javascript.
first i wil start off and show my mysql query.
$cityl=mysql_query("SELECT * FROM citylocation WHERE citylong < {$ir['userlongitute']}+5 AND citylong > {$ir['userlongitute']}-5 AND citylat > {$ir['userlatitude']}-5 AND citylat < {$ir['userlatitude']}+5 ");
$cityarray = mysql_fetch_array( $cityl);
the npclocation table has the following fields w/descriptions
citylocid - autoincrement
cityid - id for cities
citylname - name for the cities
citylong - longitude for cities
citylat - latitude for cities
inside the javascript I have
var newpoints = new Array();
and here is the function inside the javascript
function addPoints() {
newpoints[0] = new Array(51.45400691005981, -2.63671875, icon0, 'bristol', 'bristol');
newpoints[1] = new Array(53.30462107510271, -6.1962890625, icon0, 'dublin', 'dublin');
newpoints[2] = new Array(30.031055426540206, -90, icon0, 'New Orleans', 'New Orleans');
for(var i = 0; i < newpoints.length; i++) {
var point = new GPoint(newpoints[i][1],newpoints[i][0]);
var popuphtml = newpoints[i][4] ;
var marker = createMarker(point,newpoints[i][2],popuphtml);
map.addOverlay(marker);
}
}
As you can see there are numerous newpoints[somenumber] and array info.
I dont want to have to have lines like that, i want to integrate the table fields array into the line and then i guess looped through until the end of the line.
to something like
newpoints[?] = new Array(citylong, citylat, icon0, 'citylname', 'citylname');
or something like that
I am terrible at js skills
my php skills could be better, but I can get the job done in php.
Any help would be great appreciated.