creating an array from a mySQL query



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

.



Relevant Pages

  • Re: [PHP] what is better way to write the query
    ... it's maybe more question for mysql list, but since php is involved ... mysql_queryor die ); ... I would perform multiple inserts @ a time. ...
    (php.general)
  • Re: [PHP] what is better way to write the query
    ... it's maybe more question for mysql list, but since php is involved ... mysql_queryor die ); ... I would perform multiple inserts @ a time. ...
    (php.general)
  • Re: I am totally stumped..with this on..LOAD_FILE Mysql+PHP= FSCK!!
    ... What I am trying to do is to upload files and stuff them in a mysql database. ... I copied the temporary file to somewhere else, and then handed it to MySQL..THAT WORKED.. ... Is there a way to force a close on the file..maybe that's the problem Mysql is opening a file that is not flushed to disk maybe? ... I gew the feeling its maintaining its own picture of file objects, and doesn't actually flush to the disk unless you do a copy or close php.. ...
    (comp.lang.php)
  • Re: I am totally stumped..with this on..LOAD_FILE Mysql+PHP= FSCK!!
    ... What I am trying to do is to upload files and stuff them in a mysql database. ... I copied the temporary file to somewhere else, and then handed it to MySQL..THAT WORKED.. ... Is there a way to force a close on the file..maybe that's the problem Mysql is opening a file that is not flushed to disk maybe? ... I gew the feeling its maintaining its own picture of file objects, and doesn't actually flush to the disk unless you do a copy or close php.. ...
    (comp.lang.php)
  • Re: com_dotnet
    ... And if MySQL isn't installed, the DLL won't load and phpinfowill show MySQL support isn't enabled. ... The MySQL interface is NOT compiled into PHP on the distributed Windows binaries - or you'd never be able to run PHP unless you had MySQL installed. ... *SOME* extensions are protocols, some are functional resources, and some are just type libraries. ... If you're going to compile the extension into PHP itself, the libraries must be available at compile time, and when you run PHP, or PHP won't load. ...
    (comp.lang.php)