creating an array from a mySQL query
- From: "ericv" <eric.venden@xxxxxxxxx>
- Date: 24 Aug 2006 11:39:31 -0700
I am new to php and mySQL and have a problem..
we have the following code that successfully retreives data from a
mySQL database and then posts it to the Google Maps API which then maps
the latitude (a field in the db) and longitude (yet another field in
the db).
// Retrieve all the data from the table
$result = mysql_query("SELECT * FROM points_of_interest WHERE
(KEY_ID='$KEY')")
or die(mysql_error());
$num_rows = mysql_num_rows($result);
if ($num_rows==0){
echo "<font face='Arial' size='2'><c><b>Point of interest not
found.</b><br />Please try again.<a href='main.php'>Click here</a> to
try another point.</c></font>";
} else{
// store the record of the table into $row
$row = mysql_fetch_array( $result );
The Google API is javascript and we then retrieve the mySQL data for
mapping with the following code (inside of the google javascript):
// retrieve latitude and longitude for mapping
<?php
print "var latitude = $row[LAT];";
print "var longitude = $row[LONG];";
print "var namelong = '$row[NAME_LONG]';";
print "var address = $row[ADDR_NUM];";
print "var stname = '$row[ST_NAMEFULL]';";
I would like to use an array to feed multiple rows of data to the
Google API to map multiple data points (multiple latitude and longitude
values)..
I have looked in the php manuals for how to define an array, but I
don't seem to get a clear idea of how to do it.
Any ideas?
Thanks
Eric V
Gurnee, IL
.
- Follow-Ups:
- Re: creating an array from a mySQL query
- From: huckphin
- Re: creating an array from a mySQL query
- Prev by Date: Re: Direct MDB linking
- Next by Date: Problem with $_GET
- Previous by thread: Direct MDB linking
- Next by thread: Re: creating an array from a mySQL query
- Index(es):
Relevant Pages
|